dashboard: color relay buttons by state
This commit is contained in:
@@ -307,6 +307,24 @@ static void update_relay_buttons()
|
||||
label += on_off(relay_states[i]);
|
||||
|
||||
lv_label_set_text(relay_button_labels[i], label.c_str());
|
||||
|
||||
if (relay_count >= 5) {
|
||||
lv_obj_set_style_text_font(relay_button_labels[i], &lv_font_montserrat_30, 0);
|
||||
} else {
|
||||
lv_obj_set_style_text_font(relay_button_labels[i], &lv_font_montserrat_40, 0);
|
||||
}
|
||||
|
||||
if (relay_states[i]) {
|
||||
lv_obj_set_style_bg_color(relay_buttons[i], lv_color_hex(0x027A48), 0);
|
||||
lv_obj_set_style_border_color(relay_buttons[i], lv_color_hex(0x32D583), 0);
|
||||
lv_obj_set_style_border_width(relay_buttons[i], 2, 0);
|
||||
} else {
|
||||
lv_obj_set_style_bg_color(relay_buttons[i], lv_color_hex(0x26313D), 0);
|
||||
lv_obj_set_style_border_color(relay_buttons[i], lv_color_hex(0x3A4652), 0);
|
||||
lv_obj_set_style_border_width(relay_buttons[i], 2, 0);
|
||||
}
|
||||
|
||||
lv_obj_set_style_text_color(relay_button_labels[i], lv_color_hex(0xFFFFFF), 0);
|
||||
} else {
|
||||
lv_obj_add_flag(relay_buttons[i], LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user