Author: Riku Isokoski <riksu9000@gmail.com>
Centralize most color definitions (#1258)
src/CMakeLists.txt | 4 src/displayapp/LittleVgl.cpp | 2 | 41 ++++---- | 20 ++-- src/displayapp/screens/Alarm.cpp | 3 src/displayapp/screens/BatteryInfo.cpp | 9 + src/displayapp/screens/FirmwareValidation.cpp | 5 src/displayapp/screens/FlashLight.cpp | 3 src/displayapp/screens/HeartRate.cpp | 14 +- src/displayapp/screens/InfiniPaint.cpp | 3 src/displayapp/screens/Metronome.cpp | 3 src/displayapp/screens/Motion.cpp | 3 src/displayapp/screens/Navigation.cpp | 3 src/displayapp/screens/Notifications.cpp | 9 + src/displayapp/screens/PassKey.cpp | 2 src/displayapp/screens/Steps.cpp | 4 src/displayapp/screens/StopWatch.cpp | 13 +- src/displayapp/screens/Styles.cpp | 3 src/displayapp/screens/SystemInfo.cpp | 3 src/displayapp/screens/Tile.cpp | 3 src/displayapp/screens/Timer.cpp | 3 src/displayapp/screens/WatchFaceAnalog.cpp | 5 src/displayapp/screens/WatchFaceDigital.cpp | 2 src/displayapp/screens/WatchFacePineTimeStyle.cpp | 4 src/displayapp/screens/settings/QuickSettings.cpp | 5 src/displayapp/screens/settings/SettingSetTime.cpp | 4 src/displayapp/screens/settings/SettingShakeThreshold.cpp | 4 src/displayapp/screens/settings/SettingSteps.cpp | 1 src/displayapp/screens/settings/SettingWatchFace.cpp | 1 src/displayapp/widgets/Counter.cpp | 9 - src/displayapp/widgets/PageIndicator.cpp | 5 src/displayapp/widgets/StatusIcons.cpp | 2
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cfab2f543766147daca5fb07e2358870ffd4a9e9..db4a8e2aae5faea77b122642dee236fc12085006 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -477,7 +477,7 @@ FreeRTOS/port_cmsis_systick.c FreeRTOS/port_cmsis.c displayapp/LittleVgl.cpp - displayapp/lv_pinetime_theme.c + displayapp/InfiniTimeTheme.cpp systemtask/SystemTask.cpp systemtask/SystemMonitor.cpp @@ -663,7 +663,7 @@ libs/date/include/date/julian.h libs/date/include/date/ptz.h libs/date/include/date/tz_private.h displayapp/LittleVgl.h - displayapp/lv_pinetime_theme.h + displayapp/InfiniTimeTheme.h systemtask/SystemTask.h systemtask/SystemMonitor.h displayapp/screens/Symbols.h diff --git a/src/displayapp/InfiniTimeTheme.cpp b/src/displayapp/InfiniTimeTheme.cpp new file mode 100644 index 0000000000000000000000000000000000000000..89887573b19e44d1584330123a30d15f16677964 --- /dev/null +++ b/src/displayapp/InfiniTimeTheme.cpp @@ -0,0 +1,446 @@ +#include "displayapp/InfiniTimeTheme.h" + +static void theme_apply(lv_obj_t* obj, lv_theme_style_t name); + +static lv_theme_t theme; + +static lv_style_t style_bg; +static lv_style_t style_box; +static lv_style_t style_btn; +static lv_style_t style_label_white; +static lv_style_t style_icon; +static lv_style_t style_bar_indic; +static lv_style_t style_slider_knob; +static lv_style_t style_scrollbar; +static lv_style_t style_list_btn; +static lv_style_t style_ddlist_list; +static lv_style_t style_ddlist_selected; +static lv_style_t style_sw_bg; +static lv_style_t style_sw_indic; +static lv_style_t style_sw_knob; +static lv_style_t style_arc_bg; +static lv_style_t style_arc_knob; +static lv_style_t style_arc_indic; +static lv_style_t style_table_cell; +static lv_style_t style_pad_small; +static lv_style_t style_lmeter; +static lv_style_t style_chart_serie; +static lv_style_t style_cb_bg; +static lv_style_t style_cb_bullet; + +static bool inited; + +static void style_init_reset(lv_style_t* style) { + if (inited) { + lv_style_reset(style); + } else { + lv_style_init(style); + } +} + +static void basic_init() { + style_init_reset(&style_bg); + lv_style_set_bg_opa(&style_bg, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_bg, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_style_set_text_font(&style_bg, LV_STATE_DEFAULT, theme.font_normal); + + style_init_reset(&style_box); + lv_style_set_bg_opa(&style_box, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_radius(&style_box, LV_STATE_DEFAULT, 10); + lv_style_set_value_color(&style_box, LV_STATE_DEFAULT, Colors::bg); + lv_style_set_value_font(&style_box, LV_STATE_DEFAULT, theme.font_normal); + + style_init_reset(&style_label_white); + lv_style_set_text_color(&style_label_white, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_text_color(&style_label_white, LV_STATE_DISABLED, LV_COLOR_GRAY); + + style_init_reset(&style_btn); + lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, 10); + lv_style_set_bg_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_btn, LV_STATE_DEFAULT, Colors::bg); + lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, Colors::highlight); + lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED, Colors::bgDark); + lv_style_set_border_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, 0); + + lv_style_set_text_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_text_color(&style_btn, LV_STATE_DISABLED, LV_COLOR_GRAY); + + lv_style_set_value_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_value_color(&style_btn, LV_STATE_DISABLED, LV_COLOR_GRAY); + + lv_style_set_pad_left(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_right(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_top(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_bottom(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_inner(&style_btn, LV_STATE_DEFAULT, LV_DPX(15)); + lv_style_set_outline_width(&style_btn, LV_STATE_DEFAULT, LV_DPX(2)); + lv_style_set_outline_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_0); + lv_style_set_outline_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_transition_time(&style_btn, LV_STATE_DEFAULT, 0); + lv_style_set_transition_delay(&style_btn, LV_STATE_DEFAULT, 0); + + style_init_reset(&style_icon); + lv_style_set_text_color(&style_icon, LV_STATE_DEFAULT, LV_COLOR_WHITE); + + style_init_reset(&style_bar_indic); + lv_style_set_bg_opa(&style_bar_indic, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_radius(&style_bar_indic, LV_STATE_DEFAULT, 10); + + style_init_reset(&style_scrollbar); + lv_style_set_bg_opa(&style_scrollbar, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_radius(&style_scrollbar, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_bg_color(&style_scrollbar, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_size(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 80); + lv_style_set_pad_right(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 60); + + style_init_reset(&style_list_btn); + lv_style_set_bg_opa(&style_list_btn, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_list_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_text_color(&style_list_btn, LV_STATE_DEFAULT, Colors::bg); + lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED, LV_COLOR_WHITE); + lv_style_set_image_recolor(&style_list_btn, LV_STATE_DEFAULT, Colors::bg); + lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED, LV_COLOR_WHITE); + lv_style_set_pad_left(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25); + lv_style_set_pad_right(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25); + lv_style_set_pad_top(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100); + lv_style_set_pad_bottom(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100); + lv_style_set_pad_inner(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 50); + + style_init_reset(&style_ddlist_list); + // Causes lag unfortunately, so we'll have to live with the selected item overflowing the corner + // lv_style_set_clip_corner(&style_ddlist_list, LV_STATE_DEFAULT, true); + lv_style_set_text_line_space(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 25); + lv_style_set_bg_color(&style_ddlist_list, LV_STATE_DEFAULT, Colors::lightGray); + lv_style_set_pad_all(&style_ddlist_list, LV_STATE_DEFAULT, 20); + + style_init_reset(&style_ddlist_selected); + lv_style_set_bg_opa(&style_ddlist_selected, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_ddlist_selected, LV_STATE_DEFAULT, Colors::bg); + + style_init_reset(&style_sw_bg); + lv_style_set_bg_opa(&style_sw_bg, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_sw_bg, LV_STATE_DEFAULT, Colors::bg); + lv_style_set_radius(&style_sw_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + + style_init_reset(&style_sw_indic); + lv_style_set_bg_opa(&style_sw_indic, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_sw_indic, LV_STATE_DEFAULT, Colors::highlight); + + style_init_reset(&style_sw_knob); + lv_style_set_bg_opa(&style_sw_knob, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_sw_knob, LV_STATE_DEFAULT, LV_COLOR_SILVER); + lv_style_set_bg_color(&style_sw_knob, LV_STATE_CHECKED, LV_COLOR_WHITE); + lv_style_set_radius(&style_sw_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_pad_top(&style_sw_knob, LV_STATE_DEFAULT, -4); + lv_style_set_pad_bottom(&style_sw_knob, LV_STATE_DEFAULT, -4); + lv_style_set_pad_left(&style_sw_knob, LV_STATE_DEFAULT, -4); + lv_style_set_pad_right(&style_sw_knob, LV_STATE_DEFAULT, -4); + + style_init_reset(&style_slider_knob); + lv_style_set_bg_opa(&style_slider_knob, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_style_set_border_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_border_width(&style_slider_knob, LV_STATE_DEFAULT, 6); + lv_style_set_radius(&style_slider_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_pad_top(&style_slider_knob, LV_STATE_DEFAULT, 10); + lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_DEFAULT, 10); + lv_style_set_pad_left(&style_slider_knob, LV_STATE_DEFAULT, 10); + lv_style_set_pad_right(&style_slider_knob, LV_STATE_DEFAULT, 10); + lv_style_set_pad_top(&style_slider_knob, LV_STATE_PRESSED, 14); + lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_PRESSED, 14); + lv_style_set_pad_left(&style_slider_knob, LV_STATE_PRESSED, 14); + lv_style_set_pad_right(&style_slider_knob, LV_STATE_PRESSED, 14); + + style_init_reset(&style_arc_indic); + lv_style_set_line_color(&style_arc_indic, LV_STATE_DEFAULT, Colors::lightGray); + lv_style_set_line_width(&style_arc_indic, LV_STATE_DEFAULT, LV_DPX(25)); + lv_style_set_line_rounded(&style_arc_indic, LV_STATE_DEFAULT, true); + + style_init_reset(&style_arc_bg); + lv_style_set_line_color(&style_arc_bg, LV_STATE_DEFAULT, Colors::bg); + lv_style_set_line_width(&style_arc_bg, LV_STATE_DEFAULT, LV_DPX(25)); + lv_style_set_line_rounded(&style_arc_bg, LV_STATE_DEFAULT, true); + lv_style_set_pad_all(&style_arc_bg, LV_STATE_DEFAULT, LV_DPX(5)); + + lv_style_reset(&style_arc_knob); + lv_style_set_radius(&style_arc_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_bg_opa(&style_arc_knob, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_arc_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_pad_all(&style_arc_knob, LV_STATE_DEFAULT, LV_DPX(5)); + + style_init_reset(&style_table_cell); + lv_style_set_border_color(&style_table_cell, LV_STATE_DEFAULT, LV_COLOR_GRAY); + lv_style_set_border_width(&style_table_cell, LV_STATE_DEFAULT, 1); + lv_style_set_border_side(&style_table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL); + lv_style_set_pad_left(&style_table_cell, LV_STATE_DEFAULT, 5); + lv_style_set_pad_right(&style_table_cell, LV_STATE_DEFAULT, 5); + lv_style_set_pad_top(&style_table_cell, LV_STATE_DEFAULT, 2); + lv_style_set_pad_bottom(&style_table_cell, LV_STATE_DEFAULT, 2); + + style_init_reset(&style_pad_small); + lv_style_int_t pad_small_value = 10; + lv_style_set_pad_left(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); + lv_style_set_pad_right(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); + lv_style_set_pad_top(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); + lv_style_set_pad_bottom(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); + lv_style_set_pad_inner(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); + + style_init_reset(&style_lmeter); + lv_style_set_radius(&style_lmeter, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_pad_left(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_right(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_top(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_inner(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(30)); + lv_style_set_scale_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(25)); + + lv_style_set_line_color(&style_lmeter, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_scale_grad_color(&style_lmeter, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_scale_end_color(&style_lmeter, LV_STATE_DEFAULT, LV_COLOR_GRAY); + lv_style_set_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(10)); + lv_style_set_scale_end_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(7)); + + style_init_reset(&style_chart_serie); + lv_style_set_line_color(&style_chart_serie, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_line_width(&style_chart_serie, LV_STATE_DEFAULT, 4); + lv_style_set_size(&style_chart_serie, LV_STATE_DEFAULT, 4); + lv_style_set_bg_opa(&style_chart_serie, LV_STATE_DEFAULT, 0); + + lv_style_reset(&style_cb_bg); + lv_style_set_radius(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(4)); + lv_style_set_pad_inner(&style_cb_bg, LV_STATE_DEFAULT, 18); + lv_style_set_outline_color(&style_cb_bg, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_outline_width(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(2)); + lv_style_set_outline_pad(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_transition_time(&style_cb_bg, LV_STATE_DEFAULT, 0); + lv_style_set_transition_prop_6(&style_cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA); + + lv_style_reset(&style_cb_bullet); + lv_style_set_outline_opa(&style_cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP); + lv_style_set_radius(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(4)); + lv_style_set_pattern_recolor(&style_cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE); + lv_style_set_pad_left(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); + lv_style_set_pad_right(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); + lv_style_set_pad_top(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); + lv_style_set_pad_bottom(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); +} + +/** + * Initialize the default + * @param color_primary the primary color of the theme + * @param color_secondary the secondary color for the theme + * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` + * @param font_small pointer to a small font + * @param font_normal pointer to a normal font + * @param font_subtitle pointer to a large font + * @param font_title pointer to a extra large font + * @return a pointer to reference this theme later + */ +lv_theme_t* lv_pinetime_theme_init(lv_color_t color_primary, + lv_color_t color_secondary, + uint32_t flags, + const lv_font_t* font_small, + const lv_font_t* font_normal, + const lv_font_t* font_subtitle, + const lv_font_t* font_title) { + theme.color_primary = color_primary; + theme.color_secondary = color_secondary; + theme.font_small = font_small; + theme.font_normal = font_normal; + theme.font_subtitle = font_subtitle; + theme.font_title = font_title; + theme.flags = flags; + + basic_init(); + + theme.apply_xcb = theme_apply; + + inited = true; + + return &theme; +} + +static void theme_apply(lv_obj_t* obj, lv_theme_style_t name) { + lv_style_list_t* list; + + switch (name) { + case LV_THEME_NONE: + break; + + case LV_THEME_SCR: + lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); + _lv_style_list_add_style(list, &style_bg); + _lv_style_list_add_style(list, &style_label_white); + break; + + case LV_THEME_OBJ: + lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); + _lv_style_list_add_style(list, &style_box); + break; + + case LV_THEME_CONT: + lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN); + _lv_style_list_add_style(list, &style_box); + break; + + case LV_THEME_BTN: + lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); + _lv_style_list_add_style(list, &style_btn); + break; + + case LV_THEME_BTNMATRIX: + list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG); + _lv_style_list_add_style(list, &style_bg); + _lv_style_list_add_style(list, &style_pad_small); + + list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN); + _lv_style_list_add_style(list, &style_btn); + break; + + case LV_THEME_BAR: + lv_obj_clean_style_list(obj, LV_BAR_PART_BG); + list = lv_obj_get_style_list(obj, LV_BAR_PART_BG); + + lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC); + list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC); + _lv_style_list_add_style(list, &style_bar_indic); + break; + + case LV_THEME_IMAGE: + lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN); + _lv_style_list_add_style(list, &style_icon); + break; + + case LV_THEME_LABEL: + lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN); + _lv_style_list_add_style(list, &style_label_white); + break; + + case LV_THEME_SLIDER: + lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG); + list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG); + _lv_style_list_add_style(list, &style_sw_bg); + + lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC); + list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC); + + lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB); + list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB); + _lv_style_list_add_style(list, &style_slider_knob); + break; + + case LV_THEME_LIST: + lv_obj_clean_style_list(obj, LV_LIST_PART_BG); + list = lv_obj_get_style_list(obj, LV_LIST_PART_BG); + _lv_style_list_add_style(list, &style_box); + + lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE); + list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE); + + lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR); + _lv_style_list_add_style(list, &style_scrollbar); + break; + + case LV_THEME_LIST_BTN: + lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); + _lv_style_list_add_style(list, &style_list_btn); + break; + + case LV_THEME_ARC: + lv_obj_clean_style_list(obj, LV_ARC_PART_BG); + list = lv_obj_get_style_list(obj, LV_ARC_PART_BG); + _lv_style_list_add_style(list, &style_arc_bg); + + lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC); + list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC); + _lv_style_list_add_style(list, &style_arc_indic); + + lv_obj_clean_style_list(obj, LV_ARC_PART_KNOB); + list = lv_obj_get_style_list(obj, LV_ARC_PART_KNOB); + _lv_style_list_add_style(list, &style_arc_knob); + break; + + case LV_THEME_SWITCH: + lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG); + list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG); + _lv_style_list_add_style(list, &style_sw_bg); + + lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC); + list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC); + _lv_style_list_add_style(list, &style_sw_indic); + + lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB); + list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB); + _lv_style_list_add_style(list, &style_sw_knob); + break; + + case LV_THEME_DROPDOWN: + lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN); + _lv_style_list_add_style(list, &style_btn); + + lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST); + list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST); + _lv_style_list_add_style(list, &style_box); + _lv_style_list_add_style(list, &style_ddlist_list); + + lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED); + list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED); + _lv_style_list_add_style(list, &style_ddlist_selected); + + lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR); + _lv_style_list_add_style(list, &style_scrollbar); + break; + + case LV_THEME_TABLE: { + list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); + _lv_style_list_add_style(list, &style_bg); + + int idx = 1; /* start value should be 1, not zero, since cell styles + start at 1 due to presence of LV_TABLE_PART_BG=0 + in the enum (lv_table.h) */ + /* declaring idx outside loop to work with older compilers */ + for (; idx <= LV_TABLE_CELL_STYLE_CNT; idx++) { + list = lv_obj_get_style_list(obj, idx); + _lv_style_list_add_style(list, &style_table_cell); + _lv_style_list_add_style(list, &style_label_white); + } + } break; + + case LV_THEME_LINEMETER: + list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN); + _lv_style_list_add_style(list, &style_bg); + _lv_style_list_add_style(list, &style_lmeter); + break; + + case LV_THEME_CHART: + lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES); + list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES); + _lv_style_list_add_style(list, &style_btn); + _lv_style_list_add_style(list, &style_chart_serie); + break; + + case LV_THEME_CHECKBOX: + list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG); + _lv_style_list_add_style(list, &style_cb_bg); + + list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET); + _lv_style_list_add_style(list, &style_btn); + _lv_style_list_add_style(list, &style_cb_bullet); + break; + + default: + break; + } + + lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL); +} diff --git a/src/displayapp/InfiniTimeTheme.h b/src/displayapp/InfiniTimeTheme.h new file mode 100644 index 0000000000000000000000000000000000000000..5709b0071b5f68d9b89c7722598c356a1cf3d30b --- /dev/null +++ b/src/displayapp/InfiniTimeTheme.h @@ -0,0 +1,33 @@ +#pragma once + +#include <lvgl/lvgl.h> + +namespace Colors { + static constexpr lv_color_t orange = LV_COLOR_MAKE(0xff, 0xb0, 0x0); + static constexpr lv_color_t green = LV_COLOR_MAKE(0x0, 0xb0, 0x0); + static constexpr lv_color_t lightGray = LV_COLOR_MAKE(0xb0, 0xb0, 0xb0); + + static constexpr lv_color_t bg = LV_COLOR_MAKE(0x5d, 0x69, 0x7e); + static constexpr lv_color_t bgAlt = LV_COLOR_MAKE(0x38, 0x38, 0x38); + static constexpr lv_color_t bgDark = LV_COLOR_MAKE(0x18, 0x18, 0x18); + static constexpr lv_color_t highlight = green; +}; + +/** + * Initialize the default + * @param color_primary the primary color of the theme + * @param color_secondary the secondary color for the theme + * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` + * @param font_small pointer to a small font + * @param font_normal pointer to a normal font + * @param font_subtitle pointer to a large font + * @param font_title pointer to a extra large font + * @return a pointer to reference this theme later + */ +lv_theme_t* lv_pinetime_theme_init(lv_color_t color_primary, + lv_color_t color_secondary, + uint32_t flags, + const lv_font_t* font_small, + const lv_font_t* font_normal, + const lv_font_t* font_subtitle, + const lv_font_t* font_title); diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp index 64c99261764eb100eed7e6a0d1f6a1c31e1af350..d5f31848c46cb2f72ad123f0e42d3f7702a67329 100644 --- a/src/displayapp/LittleVgl.cpp +++ b/src/displayapp/LittleVgl.cpp @@ -1,5 +1,5 @@ #include "displayapp/LittleVgl.h" -#include "displayapp/lv_pinetime_theme.h" +#include "displayapp/InfiniTimeTheme.h" #include <FreeRTOS.h> #include <task.h> diff --git a/src/displayapp/lv_pinetime_theme.c b/src/displayapp/lv_pinetime_theme.c deleted file mode 100644 index f712004afdffeb879c283cdec8eb531b5acb197f..0000000000000000000000000000000000000000 --- a/src/displayapp/lv_pinetime_theme.c +++ /dev/null @@ -1,447 +0,0 @@ -#include "displayapp/lv_pinetime_theme.h" - -static void theme_apply(lv_obj_t* obj, lv_theme_style_t name); - -static lv_theme_t theme; - -static lv_style_t style_bg; -static lv_style_t style_box; -static lv_style_t style_btn; -static lv_style_t style_label_white; -static lv_style_t style_icon; -static lv_style_t style_bar_indic; -static lv_style_t style_slider_knob; -static lv_style_t style_scrollbar; -static lv_style_t style_list_btn; -static lv_style_t style_ddlist_list; -static lv_style_t style_ddlist_selected; -static lv_style_t style_sw_bg; -static lv_style_t style_sw_indic; -static lv_style_t style_sw_knob; -static lv_style_t style_arc_bg; -static lv_style_t style_arc_knob; -static lv_style_t style_arc_indic; -static lv_style_t style_table_cell; -static lv_style_t style_pad_small; -static lv_style_t style_lmeter; -static lv_style_t style_chart_serie; -static lv_style_t style_cb_bg; -static lv_style_t style_cb_bullet; - -static bool inited; - -static void style_init_reset(lv_style_t* style) { - if (inited) - lv_style_reset(style); - else - lv_style_init(style); -} - -static void basic_init(void) { - style_init_reset(&style_bg); - lv_style_set_bg_opa(&style_bg, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_bg, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_style_set_text_font(&style_bg, LV_STATE_DEFAULT, theme.font_normal); - - style_init_reset(&style_box); - lv_style_set_bg_opa(&style_box, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_radius(&style_box, LV_STATE_DEFAULT, 10); - lv_style_set_value_color(&style_box, LV_STATE_DEFAULT, IT_COLOR_BG); - lv_style_set_value_font(&style_box, LV_STATE_DEFAULT, theme.font_normal); - - style_init_reset(&style_label_white); - lv_style_set_text_color(&style_label_white, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_text_color(&style_label_white, LV_STATE_DISABLED, LV_COLOR_GRAY); - - style_init_reset(&style_btn); - lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, 10); - lv_style_set_bg_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_btn, LV_STATE_DEFAULT, IT_COLOR_BG); - lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, IT_COLOR_SEL); - lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED, IT_COLOR_BG_DARK); - lv_style_set_border_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, 0); - - lv_style_set_text_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_text_color(&style_btn, LV_STATE_DISABLED, LV_COLOR_GRAY); - - lv_style_set_value_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_value_color(&style_btn, LV_STATE_DISABLED, LV_COLOR_GRAY); - - lv_style_set_pad_left(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_right(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_top(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_bottom(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_inner(&style_btn, LV_STATE_DEFAULT, LV_DPX(15)); - lv_style_set_outline_width(&style_btn, LV_STATE_DEFAULT, LV_DPX(2)); - lv_style_set_outline_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_0); - lv_style_set_outline_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_transition_time(&style_btn, LV_STATE_DEFAULT, 0); - lv_style_set_transition_delay(&style_btn, LV_STATE_DEFAULT, 0); - - style_init_reset(&style_icon); - lv_style_set_text_color(&style_icon, LV_STATE_DEFAULT, LV_COLOR_WHITE); - - style_init_reset(&style_bar_indic); - lv_style_set_bg_opa(&style_bar_indic, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_radius(&style_bar_indic, LV_STATE_DEFAULT, 10); - - style_init_reset(&style_scrollbar); - lv_style_set_bg_opa(&style_scrollbar, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_radius(&style_scrollbar, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_bg_color(&style_scrollbar, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_size(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 80); - lv_style_set_pad_right(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 60); - - style_init_reset(&style_list_btn); - lv_style_set_bg_opa(&style_list_btn, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_list_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_text_color(&style_list_btn, LV_STATE_DEFAULT, IT_COLOR_BG); - lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED, LV_COLOR_WHITE); - lv_style_set_image_recolor(&style_list_btn, LV_STATE_DEFAULT, IT_COLOR_BG); - lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED, LV_COLOR_WHITE); - lv_style_set_pad_left(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25); - lv_style_set_pad_right(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25); - lv_style_set_pad_top(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100); - lv_style_set_pad_bottom(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100); - lv_style_set_pad_inner(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 50); - - style_init_reset(&style_ddlist_list); - // Causes lag unfortunately, so we'll have to live with the selected item overflowing the corner - // lv_style_set_clip_corner(&style_ddlist_list, LV_STATE_DEFAULT, true); - lv_style_set_text_line_space(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 25); - lv_style_set_bg_color(&style_ddlist_list, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); - lv_style_set_pad_all(&style_ddlist_list, LV_STATE_DEFAULT, 20); - - style_init_reset(&style_ddlist_selected); - lv_style_set_bg_opa(&style_ddlist_selected, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_ddlist_selected, LV_STATE_DEFAULT, IT_COLOR_BG); - - style_init_reset(&style_sw_bg); - lv_style_set_bg_opa(&style_sw_bg, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_sw_bg, LV_STATE_DEFAULT, IT_COLOR_BG); - lv_style_set_radius(&style_sw_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - - style_init_reset(&style_sw_indic); - lv_style_set_bg_opa(&style_sw_indic, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_sw_indic, LV_STATE_DEFAULT, IT_COLOR_SEL); - - style_init_reset(&style_sw_knob); - lv_style_set_bg_opa(&style_sw_knob, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_sw_knob, LV_STATE_DEFAULT, LV_COLOR_SILVER); - lv_style_set_bg_color(&style_sw_knob, LV_STATE_CHECKED, LV_COLOR_WHITE); - lv_style_set_radius(&style_sw_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_pad_top(&style_sw_knob, LV_STATE_DEFAULT, -4); - lv_style_set_pad_bottom(&style_sw_knob, LV_STATE_DEFAULT, -4); - lv_style_set_pad_left(&style_sw_knob, LV_STATE_DEFAULT, -4); - lv_style_set_pad_right(&style_sw_knob, LV_STATE_DEFAULT, -4); - - style_init_reset(&style_slider_knob); - lv_style_set_bg_opa(&style_slider_knob, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_RED); - lv_style_set_border_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_border_width(&style_slider_knob, LV_STATE_DEFAULT, 6); - lv_style_set_radius(&style_slider_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_pad_top(&style_slider_knob, LV_STATE_DEFAULT, 10); - lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_DEFAULT, 10); - lv_style_set_pad_left(&style_slider_knob, LV_STATE_DEFAULT, 10); - lv_style_set_pad_right(&style_slider_knob, LV_STATE_DEFAULT, 10); - lv_style_set_pad_top(&style_slider_knob, LV_STATE_PRESSED, 14); - lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_PRESSED, 14); - lv_style_set_pad_left(&style_slider_knob, LV_STATE_PRESSED, 14); - lv_style_set_pad_right(&style_slider_knob, LV_STATE_PRESSED, 14); - - style_init_reset(&style_arc_indic); - lv_style_set_line_color(&style_arc_indic, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); - lv_style_set_line_width(&style_arc_indic, LV_STATE_DEFAULT, LV_DPX(25)); - lv_style_set_line_rounded(&style_arc_indic, LV_STATE_DEFAULT, true); - - style_init_reset(&style_arc_bg); - lv_style_set_line_color(&style_arc_bg, LV_STATE_DEFAULT, IT_COLOR_BG); - lv_style_set_line_width(&style_arc_bg, LV_STATE_DEFAULT, LV_DPX(25)); - lv_style_set_line_rounded(&style_arc_bg, LV_STATE_DEFAULT, true); - lv_style_set_pad_all(&style_arc_bg, LV_STATE_DEFAULT, LV_DPX(5)); - - lv_style_reset(&style_arc_knob); - lv_style_set_radius(&style_arc_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_bg_opa(&style_arc_knob, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_arc_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_pad_all(&style_arc_knob, LV_STATE_DEFAULT, LV_DPX(5)); - - style_init_reset(&style_table_cell); - lv_style_set_border_color(&style_table_cell, LV_STATE_DEFAULT, LV_COLOR_GRAY); - lv_style_set_border_width(&style_table_cell, LV_STATE_DEFAULT, 1); - lv_style_set_border_side(&style_table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL); - lv_style_set_pad_left(&style_table_cell, LV_STATE_DEFAULT, 5); - lv_style_set_pad_right(&style_table_cell, LV_STATE_DEFAULT, 5); - lv_style_set_pad_top(&style_table_cell, LV_STATE_DEFAULT, 2); - lv_style_set_pad_bottom(&style_table_cell, LV_STATE_DEFAULT, 2); - - style_init_reset(&style_pad_small); - lv_style_int_t pad_small_value = 10; - lv_style_set_pad_left(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); - lv_style_set_pad_right(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); - lv_style_set_pad_top(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); - lv_style_set_pad_bottom(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); - lv_style_set_pad_inner(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); - - style_init_reset(&style_lmeter); - lv_style_set_radius(&style_lmeter, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_pad_left(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_right(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_top(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_inner(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(30)); - lv_style_set_scale_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(25)); - - lv_style_set_line_color(&style_lmeter, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_scale_grad_color(&style_lmeter, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_scale_end_color(&style_lmeter, LV_STATE_DEFAULT, LV_COLOR_GRAY); - lv_style_set_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(10)); - lv_style_set_scale_end_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(7)); - - style_init_reset(&style_chart_serie); - lv_style_set_line_color(&style_chart_serie, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_line_width(&style_chart_serie, LV_STATE_DEFAULT, 4); - lv_style_set_size(&style_chart_serie, LV_STATE_DEFAULT, 4); - lv_style_set_bg_opa(&style_chart_serie, LV_STATE_DEFAULT, 0); - - lv_style_reset(&style_cb_bg); - lv_style_set_radius(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(4)); - lv_style_set_pad_inner(&style_cb_bg, LV_STATE_DEFAULT, 18); - lv_style_set_outline_color(&style_cb_bg, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_outline_width(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(2)); - lv_style_set_outline_pad(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_transition_time(&style_cb_bg, LV_STATE_DEFAULT, 0); - lv_style_set_transition_prop_6(&style_cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA); - - lv_style_reset(&style_cb_bullet); - lv_style_set_outline_opa(&style_cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP); - lv_style_set_radius(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(4)); - lv_style_set_pattern_recolor(&style_cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE); - lv_style_set_pad_left(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); - lv_style_set_pad_right(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); - lv_style_set_pad_top(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); - lv_style_set_pad_bottom(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); -} - -/** - * Initialize the default - * @param color_primary the primary color of the theme - * @param color_secondary the secondary color for the theme - * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` - * @param font_small pointer to a small font - * @param font_normal pointer to a normal font - * @param font_subtitle pointer to a large font - * @param font_title pointer to a extra large font - * @return a pointer to reference this theme later - */ -lv_theme_t* lv_pinetime_theme_init(lv_color_t color_primary, - lv_color_t color_secondary, - uint32_t flags, - const lv_font_t* font_small, - const lv_font_t* font_normal, - const lv_font_t* font_subtitle, - const lv_font_t* font_title) { - theme.color_primary = color_primary; - theme.color_secondary = color_secondary; - theme.font_small = font_small; - theme.font_normal = font_normal; - theme.font_subtitle = font_subtitle; - theme.font_title = font_title; - theme.flags = flags; - - basic_init(); - - theme.apply_xcb = theme_apply; - - inited = true; - - return &theme; -} - -static void theme_apply(lv_obj_t* obj, lv_theme_style_t name) { - lv_style_list_t* list; - - /*To avoid warnings*/ - uint32_t name_int = (uint32_t) name; - switch (name_int) { - case LV_THEME_NONE: - break; - - case LV_THEME_SCR: - lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); - _lv_style_list_add_style(list, &style_bg); - _lv_style_list_add_style(list, &style_label_white); - break; - - case LV_THEME_OBJ: - lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); - _lv_style_list_add_style(list, &style_box); - break; - - case LV_THEME_CONT: - lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN); - _lv_style_list_add_style(list, &style_box); - break; - - case LV_THEME_BTN: - lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &style_btn); - break; - - case LV_THEME_BTNMATRIX: - list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG); - _lv_style_list_add_style(list, &style_bg); - _lv_style_list_add_style(list, &style_pad_small); - - list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN); - _lv_style_list_add_style(list, &style_btn); - break; - - case LV_THEME_BAR: - lv_obj_clean_style_list(obj, LV_BAR_PART_BG); - list = lv_obj_get_style_list(obj, LV_BAR_PART_BG); - - lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC); - list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC); - _lv_style_list_add_style(list, &style_bar_indic); - break; - - case LV_THEME_IMAGE: - lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN); - _lv_style_list_add_style(list, &style_icon); - break; - - case LV_THEME_LABEL: - lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN); - _lv_style_list_add_style(list, &style_label_white); - break; - - case LV_THEME_SLIDER: - lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG); - list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG); - _lv_style_list_add_style(list, &style_sw_bg); - - lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC); - list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC); - - lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB); - list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB); - _lv_style_list_add_style(list, &style_slider_knob); - break; - - case LV_THEME_LIST: - lv_obj_clean_style_list(obj, LV_LIST_PART_BG); - list = lv_obj_get_style_list(obj, LV_LIST_PART_BG); - _lv_style_list_add_style(list, &style_box); - - lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE); - list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE); - - lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR); - list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR); - _lv_style_list_add_style(list, &style_scrollbar); - break; - - case LV_THEME_LIST_BTN: - lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &style_list_btn); - break; - - case LV_THEME_ARC: - lv_obj_clean_style_list(obj, LV_ARC_PART_BG); - list = lv_obj_get_style_list(obj, LV_ARC_PART_BG); - _lv_style_list_add_style(list, &style_arc_bg); - - lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC); - list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC); - _lv_style_list_add_style(list, &style_arc_indic); - - lv_obj_clean_style_list(obj, LV_ARC_PART_KNOB); - list = lv_obj_get_style_list(obj, LV_ARC_PART_KNOB); - _lv_style_list_add_style(list, &style_arc_knob); - break; - - case LV_THEME_SWITCH: - lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG); - list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG); - _lv_style_list_add_style(list, &style_sw_bg); - - lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC); - list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC); - _lv_style_list_add_style(list, &style_sw_indic); - - lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB); - list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB); - _lv_style_list_add_style(list, &style_sw_knob); - break; - - case LV_THEME_DROPDOWN: - lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN); - _lv_style_list_add_style(list, &style_btn); - - lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST); - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST); - _lv_style_list_add_style(list, &style_box); - _lv_style_list_add_style(list, &style_ddlist_list); - - lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED); - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED); - _lv_style_list_add_style(list, &style_ddlist_selected); - - lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR); - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR); - _lv_style_list_add_style(list, &style_scrollbar); - break; - - case LV_THEME_TABLE: - list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); - _lv_style_list_add_style(list, &style_bg); - - int idx = 1; /* start value should be 1, not zero, since cell styles - start at 1 due to presence of LV_TABLE_PART_BG=0 - in the enum (lv_table.h) */ - /* declaring idx outside loop to work with older compilers */ - for (; idx <= LV_TABLE_CELL_STYLE_CNT; idx++) { - list = lv_obj_get_style_list(obj, idx); - _lv_style_list_add_style(list, &style_table_cell); - _lv_style_list_add_style(list, &style_label_white); - } - break; - - case LV_THEME_LINEMETER: - list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN); - _lv_style_list_add_style(list, &style_bg); - _lv_style_list_add_style(list, &style_lmeter); - break; - - case LV_THEME_CHART: - lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES); - list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES); - _lv_style_list_add_style(list, &style_btn); - _lv_style_list_add_style(list, &style_chart_serie); - break; - - case LV_THEME_CHECKBOX: - list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG); - _lv_style_list_add_style(list, &style_cb_bg); - - list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET); - _lv_style_list_add_style(list, &style_btn); - _lv_style_list_add_style(list, &style_cb_bullet); - break; - - default: - break; - } - - lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL); -} diff --git a/src/displayapp/lv_pinetime_theme.h b/src/displayapp/lv_pinetime_theme.h deleted file mode 100644 index b68b7380cf3c810ef775746560a1052fad7e4b9b..0000000000000000000000000000000000000000 --- a/src/displayapp/lv_pinetime_theme.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include <lvgl/lvgl.h> - -#define IT_COLOR_BG LV_COLOR_MAKE(0x5d, 0x69, 0x7e) -#define IT_COLOR_BG_DARK LV_COLOR_MAKE(0x18, 0x18, 0x18) -#define IT_COLOR_SEL LV_COLOR_MAKE(0x0, 0xb0, 0x0) - -/** - * Initialize the default - * @param color_primary the primary color of the theme - * @param color_secondary the secondary color for the theme - * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` - * @param font_small pointer to a small font - * @param font_normal pointer to a normal font - * @param font_subtitle pointer to a large font - * @param font_title pointer to a extra large font - * @return a pointer to reference this theme later - */ -lv_theme_t* lv_pinetime_theme_init(lv_color_t color_primary, - lv_color_t color_secondary, - uint32_t flags, - const lv_font_t* font_small, - const lv_font_t* font_normal, - const lv_font_t* font_subtitle, - const lv_font_t* font_title); -#ifdef __cplusplus -} /* extern "C" */ -#endif diff --git a/src/displayapp/screens/Alarm.cpp b/src/displayapp/screens/Alarm.cpp index 427650c6ef76265003070260042d0579862264e7..d6371ce66fe55579b0286e56f3be5e061fce6646 100644 --- a/src/displayapp/screens/Alarm.cpp +++ b/src/displayapp/screens/Alarm.cpp @@ -18,6 +18,7 @@ */ #include "displayapp/screens/Alarm.h" #include "displayapp/screens/Screen.h" #include "displayapp/screens/Symbols.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; using Pinetime::Controllers::AlarmController; @@ -79,7 +80,7 @@ txtStop = lv_label_create(btnStop, nullptr); lv_label_set_text_static(txtStop, Symbols::stop); lv_obj_set_hidden(btnStop, true); - static constexpr lv_color_t bgColor = LV_COLOR_MAKE(0x38, 0x38, 0x38); + static constexpr lv_color_t bgColor = Colors::bgAlt; btnRecur = lv_btn_create(lv_scr_act(), nullptr); btnRecur->user_data = this; diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp index d9d479f8b14768bf7155462de937ba20652030ef..9febda61a9454922f9fe32360480b1648f8559d0 100644 --- a/src/displayapp/screens/BatteryInfo.cpp +++ b/src/displayapp/screens/BatteryInfo.cpp @@ -1,6 +1,7 @@ #include "displayapp/screens/BatteryInfo.h" #include "displayapp/DisplayApp.h" #include "components/battery/BatteryController.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -16,9 +17,9 @@ lv_bar_set_range(charging_bar, 0, 100); lv_obj_align(charging_bar, nullptr, LV_ALIGN_CENTER, 0, 10); lv_bar_set_anim_time(charging_bar, 1000); lv_obj_set_style_local_radius(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, lv_color_hex(0x222222)); + lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, Colors::bgAlt); lv_obj_set_style_local_bg_opa(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_OPA_100); - lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, lv_color_hex(0xFF0000)); + lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED); lv_bar_set_value(charging_bar, batteryPercent, LV_ANIM_ON); status = lv_label_create(lv_scr_act(), nullptr); @@ -33,7 +34,7 @@ lv_label_set_align(percent, LV_LABEL_ALIGN_LEFT); lv_obj_align(percent, nullptr, LV_ALIGN_CENTER, 0, -60); voltage = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(voltage, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xff, 0xb0, 0x0)); + lv_obj_set_style_local_text_color(voltage, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange); lv_label_set_text_fmt(voltage, "%1i.%02i volts", batteryVoltage / 1000, batteryVoltage % 1000 / 10); lv_label_set_align(voltage, LV_LABEL_ALIGN_CENTER); lv_obj_align(voltage, nullptr, LV_ALIGN_CENTER, 0, 95); @@ -62,7 +63,7 @@ } else if (batteryPercent < 10) { lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_YELLOW); lv_label_set_text_static(status, "Battery low"); } else { - lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); + lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, Colors::highlight); lv_label_set_text_static(status, "Discharging"); } diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index a3c9761633087806bcb3fbfb0f289e3deb37be4a..a2314690c35479ee15ab223abce16403f8c3e71c 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -3,6 +3,7 @@ #include#include "Version.h" #include "components/firmwarevalidator/FirmwareValidator.h" #include "displayapp/DisplayApp.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -42,7 +43,7 @@ buttonValidate->user_data = this; lv_obj_set_size(buttonValidate, 115, 50); lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); lv_obj_set_event_cb(buttonValidate, ButtonEventHandler); - lv_obj_set_style_local_bg_color(buttonValidate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); + lv_obj_set_style_local_bg_color(buttonValidate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight); labelButtonValidate = lv_label_create(buttonValidate, nullptr); lv_label_set_text_static(labelButtonValidate, "Validate"); @@ -51,7 +52,7 @@ buttonReset = lv_btn_create(lv_scr_act(), nullptr); buttonReset->user_data = this; lv_obj_set_size(buttonReset, 115, 50); lv_obj_align(buttonReset, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); - lv_obj_set_style_local_bg_color(buttonReset, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0x0, 0x0)); + lv_obj_set_style_local_bg_color(buttonReset, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); lv_obj_set_event_cb(buttonReset, ButtonEventHandler); labelButtonReset = lv_label_create(buttonReset, nullptr); diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp index b00bb0fa73abc020a8f5400a846060d6866a794b..e06b59b5b4d35ef8d83ee9d9d138299097eaaaf3 100644 --- a/src/displayapp/screens/FlashLight.cpp +++ b/src/displayapp/screens/FlashLight.cpp @@ -1,6 +1,7 @@ #include "displayapp/screens/FlashLight.h" #include "displayapp/DisplayApp.h" #include "displayapp/screens/Symbols.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -58,7 +59,7 @@ } void FlashLight::SetColors() { lv_color_t bgColor = isOn ? LV_COLOR_WHITE : LV_COLOR_BLACK; - lv_color_t fgColor = isOn ? LV_COLOR_MAKE(0xb0, 0xb0, 0xb0) : LV_COLOR_WHITE; + lv_color_t fgColor = isOn ? Colors::lightGray : LV_COLOR_WHITE; lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, bgColor); lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, fgColor); diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp index 35e06bbccba55aee32167cfc52369535d5875714..305e0c4bd92b11d1166f1ff01111532b54a07f1b 100644 --- a/src/displayapp/screens/HeartRate.cpp +++ b/src/displayapp/screens/HeartRate.cpp @@ -3,6 +3,7 @@ #include #include <components/heartrate/HeartRateController.h> #include "displayapp/DisplayApp.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -36,10 +37,11 @@ label_hr = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); - if (isHrRunning) - lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); - else - lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); + if (isHrRunning) { + lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight); + } else { + lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); + } lv_label_set_text_static(label_hr, "000"); lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40); @@ -97,12 +99,12 @@ if (heartRateController.State() == Controllers::HeartRateController::States::Stopped) { heartRateController.Start(); UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped); systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping); - lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); + lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight); } else { heartRateController.Stop(); UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped); systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping); - lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); + lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); } } } diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp index 733b4e270d111177f6bdd4e21e9bc3f50a55770e..0b6864e8925f71bd36796ff4515ea9dd2672efe0 100644 --- a/src/displayapp/screens/InfiniPaint.cpp +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -1,6 +1,7 @@ #include "displayapp/screens/InfiniPaint.h" #include "displayapp/DisplayApp.h" #include "displayapp/LittleVgl.h" +#include "displayapp/InfiniTimeTheme.h" #include <algorithm> // std::fill @@ -26,7 +27,7 @@ case 0: selectColor = LV_COLOR_MAGENTA; break; case 1: - selectColor = LV_COLOR_MAKE(0x0, 0xb0, 0x0); + selectColor = Colors::green; break; case 2: selectColor = LV_COLOR_WHITE; diff --git a/src/displayapp/screens/Metronome.cpp b/src/displayapp/screens/Metronome.cpp index 2ffc52dde3ab5b969829e43099e1740f66d3efc2..174ac1b652a59a8746ce28575a44fbb221fe91ec 100644 --- a/src/displayapp/screens/Metronome.cpp +++ b/src/displayapp/screens/Metronome.cpp @@ -1,5 +1,6 @@ #include "displayapp/screens/Metronome.h" #include "displayapp/screens/Symbols.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -12,7 +13,7 @@ lv_obj_t* createLabel(const char* name, lv_obj_t* reference, lv_align_t align, lv_font_t* font, uint8_t x, uint8_t y) { lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font); - lv_obj_set_style_local_text_color(label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); + lv_obj_set_style_local_text_color(label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); lv_label_set_text(label, name); lv_obj_align(label, reference, align, x, y); diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp index f7ffcc7c0f470ebd380b04f0b077201c80827234..c2dc4dac1ab6a9fc32272e09871ba3ad3dfc7074 100644 --- a/src/displayapp/screens/Motion.cpp +++ b/src/displayapp/screens/Motion.cpp @@ -1,6 +1,7 @@ #include "displayapp/screens/Motion.h" #include <lvgl/lvgl.h> #include "displayapp/DisplayApp.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -19,7 +20,7 @@ lv_chart_set_point_count(chart, 10); /*Add 3 data series*/ ser1 = lv_chart_add_series(chart, LV_COLOR_RED); - ser2 = lv_chart_add_series(chart, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); + ser2 = lv_chart_add_series(chart, Colors::green); ser3 = lv_chart_add_series(chart, LV_COLOR_YELLOW); lv_chart_init_points(chart, ser1, 0); diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp index 5779df3a267b5d1aa65b2f7e57b876a50537859b..f6389734e1643aaee20795208f612aa61ee78ddb 100644 --- a/src/displayapp/screens/Navigation.cpp +++ b/src/displayapp/screens/Navigation.cpp @@ -19,6 +19,7 @@ #include "displayapp/screens/Navigation.h" #include <cstdint> #include "displayapp/DisplayApp.h" #include "components/ble/NavigationService.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -192,7 +193,7 @@ lv_bar_set_value(barProgress, progress, LV_ANIM_OFF); if (progress > 90) { lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED); } else { - lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xff, 0xb0, 0x0)); + lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, Colors::orange); } } } diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 768ac2909c2486b559b6cb9ffcb9daf2ef4ed1bc..90a010f5fc391b6ed6aa4e7d5948976f7f00324e 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -4,6 +4,7 @@ #include "components/ble/MusicService.h" #include "components/ble/AlertNotificationService.h" #include "displayapp/screens/Symbols.h" #include <algorithm> +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; @@ -257,7 +258,7 @@ lv_obj_set_style_local_pad_inner(container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); lv_obj_set_style_local_border_width(container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); subject_container = lv_cont_create(container, nullptr); - lv_obj_set_style_local_bg_color(subject_container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x38, 0x38, 0x38)); + lv_obj_set_style_local_bg_color(subject_container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); lv_obj_set_style_local_pad_all(subject_container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); lv_obj_set_style_local_pad_inner(subject_container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5); lv_obj_set_style_local_border_width(subject_container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); @@ -272,7 +273,7 @@ lv_label_set_text_fmt(alert_count, "%i/%i", notifNr, notifNb); lv_obj_align(alert_count, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 16); lv_obj_t* alert_type = lv_label_create(container, nullptr); - lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xff, 0xb0, 0x0)); + lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange); if (title == nullptr) { lv_label_set_text_static(alert_type, "Notification"); } else { @@ -314,7 +315,7 @@ lv_obj_set_size(bt_accept, 76, 76); lv_obj_align(bt_accept, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); label_accept = lv_label_create(bt_accept, nullptr); lv_label_set_text_static(label_accept, Symbols::phone); - lv_obj_set_style_local_bg_color(bt_accept, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); + lv_obj_set_style_local_bg_color(bt_accept, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight); bt_reject = lv_btn_create(container, nullptr); bt_reject->user_data = this; @@ -332,7 +333,7 @@ lv_obj_set_size(bt_mute, 76, 76); lv_obj_align(bt_mute, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); label_mute = lv_label_create(bt_mute, nullptr); lv_label_set_text_static(label_mute, Symbols::volumMute); - lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); + lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); } break; } } diff --git a/src/displayapp/screens/PassKey.cpp b/src/displayapp/screens/PassKey.cpp index 4057a7eb8859fa67e390b457797121f834b1e81b..5d255e444c62d04907f266c49a040cb87bc5deb6 100644 --- a/src/displayapp/screens/PassKey.cpp +++ b/src/displayapp/screens/PassKey.cpp @@ -5,7 +5,7 @@ using namespace Pinetime::Applications::Screens; PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen(app) { passkeyLabel = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFF00)); + lv_obj_set_style_local_text_color(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); lv_obj_set_style_local_text_font(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); lv_label_set_text_fmt(passkeyLabel, "%06u", key); lv_obj_align(passkeyLabel, nullptr, LV_ALIGN_CENTER, 0, -20); diff --git a/src/displayapp/screens/Steps.cpp b/src/displayapp/screens/Steps.cpp index 0dcdcf596d0a61447fa48f3d7b2dd5cd8bc2c5df..10ccf1aa2136688ef3a9d650582361373ea25005 100644 --- a/src/displayapp/screens/Steps.cpp +++ b/src/displayapp/screens/Steps.cpp @@ -20,7 +20,7 @@ lv_obj_set_style_local_bg_opa(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, LV_OPA_0); lv_obj_set_style_local_border_width(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 2); lv_obj_set_style_local_radius(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_line_color(stepsArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, lv_color_hex(0x0000FF)); + lv_obj_set_style_local_line_color(stepsArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_BLUE); lv_arc_set_end_angle(stepsArc, 200); lv_obj_set_size(stepsArc, 240, 240); lv_arc_set_range(stepsArc, 0, 500); @@ -32,7 +32,7 @@ lv_arc_set_value(stepsArc, int16_t(500 * stepsCount / settingsController.GetStepsGoal())); lSteps = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); + lv_obj_set_style_local_text_color(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME); lv_obj_set_style_local_text_font(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); lv_label_set_text_fmt(lSteps, "%li", stepsCount); lv_obj_align(lSteps, nullptr, LV_ALIGN_CENTER, 0, -40); diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index e705fcb0bf9748eda587d6a2ddecc0b378479c59..c68cd854125220202359d6927f6f1aca73ac7ed9 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -1,6 +1,7 @@ #include "displayapp/screens/StopWatch.h" #include "displayapp/screens/Symbols.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -30,13 +31,13 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) : Screen(app), systemTask {systemTask} { time = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); - lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); + lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); lv_label_set_text_static(time, "00:00"); lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -45); msecTime = lv_label_create(lv_scr_act(), nullptr); // lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); - lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); + lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); lv_label_set_text_static(msecTime, "00"); lv_obj_align(msecTime, lv_scr_act(), LV_ALIGN_CENTER, 0, 3); @@ -75,8 +76,8 @@ void StopWatch::Reset() { currentState = States::Init; oldTimeElapsed = 0; - lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); - lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); + lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); + lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); lv_label_set_text_static(time, "00:00"); lv_label_set_text_static(msecTime, "00"); @@ -90,8 +91,8 @@ void StopWatch::Start() { lv_obj_set_state(btnStopLap, LV_STATE_DEFAULT); lv_obj_set_state(txtStopLap, LV_STATE_DEFAULT); - lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); - lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); + lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight); + lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight); lv_label_set_text_static(txtPlayPause, Symbols::pause); lv_label_set_text_static(txtStopLap, Symbols::lapsFlag); startTime = xTaskGetTickCount(); diff --git a/src/displayapp/screens/Styles.cpp b/src/displayapp/screens/Styles.cpp index bcfd584f47e2cc63fd7be3ac25c45580ed51dac6..cebdc70cc69d5c334dc1c363068ff268fce47e23 100644 --- a/src/displayapp/screens/Styles.cpp +++ b/src/displayapp/screens/Styles.cpp @@ -1,8 +1,9 @@ #include "Styles.h" +#include "displayapp/InfiniTimeTheme.h" void Pinetime::Applications::Screens::SetRadioButtonStyle(lv_obj_t* checkbox) { lv_obj_set_style_local_radius(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); lv_obj_set_style_local_border_width(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_CHECKED, 9); - lv_obj_set_style_local_border_color(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_CHECKED, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); + lv_obj_set_style_local_border_color(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_CHECKED, Colors::highlight); lv_obj_set_style_local_bg_color(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_CHECKED, LV_COLOR_WHITE); } diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index 540597969fa84b27b3830187176c3cc1c08af345..01c351955ec4fd772e1f48c4868b1dabfd611860 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -12,6 +12,7 @@ #include "components/brightness/BrightnessController.h" #include "components/datetime/DateTimeController.h" #include "components/motion/MotionController.h" #include "drivers/Watchdog.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -218,7 +219,7 @@ lv_obj_t* infoTask = lv_table_create(lv_scr_act(), nullptr); lv_table_set_col_cnt(infoTask, 4); lv_table_set_row_cnt(infoTask, maxTaskCount + 1); lv_obj_set_style_local_pad_all(infoTask, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_border_color(infoTask, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); + lv_obj_set_style_local_border_color(infoTask, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, Colors::lightGray); lv_table_set_cell_value(infoTask, 0, 0, "#"); lv_table_set_col_width(infoTask, 0, 30); diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index bf0780f18e0fb94c8fbbe15e870c43424bffe05a..a60076ed635e0f9cb03f49cd523362f647341848 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -2,6 +2,7 @@ #include "displayapp/screens/Tile.h" #include "displayapp/DisplayApp.h" #include "displayapp/screens/BatteryIcon.h" #include "components/ble/BleController.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -71,7 +72,7 @@ lv_obj_set_style_local_radius(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, 20); lv_obj_set_style_local_bg_opa(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, LV_OPA_50); lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, LV_COLOR_AQUA); lv_obj_set_style_local_bg_opa(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, LV_OPA_50); - lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, lv_color_hex(0x111111)); + lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, Colors::bgDark); lv_obj_set_style_local_pad_all(btnm1, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 0); lv_obj_set_style_local_pad_inner(btnm1, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 10); diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp index a25be1c4ffbe5bfaefa38d571f6ca82e23c9839b..136d6b52afac0695d57182ddea85c9f7af159eb3 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -1,6 +1,7 @@ #include "displayapp/screens/Timer.h" #include "displayapp/screens/Screen.h" #include "displayapp/screens/Symbols.h" +#include "displayapp/InfiniTimeTheme.h" #include <lvgl/lvgl.h> using namespace Pinetime::Applications::Screens; @@ -54,7 +55,7 @@ btnPlayPause = lv_btn_create(btnObjectMask, nullptr); btnPlayPause->user_data = this; lv_obj_set_style_local_radius(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_obj_set_style_local_bg_color(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x38, 0x38, 0x38)); + lv_obj_set_style_local_bg_color(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); lv_obj_set_event_cb(btnPlayPause, btnEventHandler); lv_obj_set_size(btnPlayPause, LV_HOR_RES, 50); diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 251a560f6eeac5db579be4781c3f756c8f8b13ae..5ebb330423d1180d46387e64f2c34f079fc5d8df 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -6,6 +6,7 @@ #include "displayapp/screens/BleIcon.h" #include "displayapp/screens/Symbols.h" #include "displayapp/screens/NotificationIcon.h" #include "components/settings/Settings.h" +#include "displayapp/InfiniTimeTheme.h" LV_IMG_DECLARE(bg_clock); @@ -73,14 +74,14 @@ lv_obj_set_style_local_text_color(plugIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); lv_obj_align(plugIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); notificationIcon = lv_label_create(lv_scr_act(), NULL); - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); lv_obj_align(notificationIcon, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0); // Date - Day / Week day label_date_day = lv_label_create(lv_scr_act(), NULL); - lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xff, 0xb0, 0x0)); + lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange); lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day()); lv_label_set_align(label_date_day, LV_LABEL_ALIGN_CENTER); lv_obj_align(label_date_day, NULL, LV_ALIGN_CENTER, 50, 0); diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 7e876d8f6e973351722fe164d59711cfe302504e..705272f7cb09b907fd6f616362f02ed4cbb19fb1 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -34,7 +34,7 @@ statusIcons.Create(); notificationIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0); diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 63b421da10a269e1b3e13241871d6cd969ed52f9..ed09f5dd5fcc45ba61c5f2f1ceee95f221ca3e0d 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -104,11 +104,11 @@ lv_obj_set_style_local_text_color(plugIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); lv_obj_align(plugIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 2); bleIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); lv_label_set_text_static(bleIcon, ""); notificationIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); lv_label_set_text_static(notificationIcon, ""); // Calendar icon diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index f756006617582656f502fdcec964e7be11bbc5ac..fba5e8760ee417c9c2442e417e85fe6389695c0c 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -2,7 +2,8 @@ #include "displayapp/screens/settings/QuickSettings.h" #include "displayapp/DisplayApp.h" #include "displayapp/screens/Symbols.h" #include "displayapp/screens/BatteryIcon.h" -#include <components/ble/BleController.h> +#include "components/ble/BleController.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -50,7 +51,7 @@ static constexpr uint8_t buttonXOffset = (LV_HOR_RES_MAX - buttonWidth * 2 - innerDistance) / 2; lv_style_init(&btn_style); lv_style_set_radius(&btn_style, LV_STATE_DEFAULT, buttonHeight / 4); - lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x38, 0x38, 0x38)); + lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, Colors::bgAlt); btn1 = lv_btn_create(lv_scr_act(), nullptr); btn1->user_data = this; diff --git a/src/displayapp/screens/settings/SettingSetTime.cpp b/src/displayapp/screens/settings/SettingSetTime.cpp index 7581f18411bbb031de07648665f64459e61f53ad..47b786e46701de68babe07f37abf06675a8def23 100644 --- a/src/displayapp/screens/settings/SettingSetTime.cpp +++ b/src/displayapp/screens/settings/SettingSetTime.cpp @@ -5,6 +5,7 @@ #include #include "displayapp/DisplayApp.h" #include "displayapp/screens/Symbols.h" #include "components/settings/Settings.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -67,8 +68,7 @@ btnSetTime->user_data = this; lv_obj_set_size(btnSetTime, 120, 50); lv_obj_align(btnSetTime, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_set_style_local_value_str(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Set"); - lv_obj_set_style_local_bg_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x38, 0x38, 0x38)); - lv_obj_set_style_local_bg_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_MAKE(0x18, 0x18, 0x18)); + lv_obj_set_style_local_bg_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); lv_obj_set_style_local_value_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_GRAY); lv_obj_set_event_cb(btnSetTime, SetTimeEventHandler); diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp index aac1eaff9485cf563c0dd7482155334edbad9e0d..de46f7de0c8b40e138177eec15ede4d1d4b93b6e 100644 --- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp +++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp @@ -3,6 +3,7 @@ #include #include "displayapp/DisplayApp.h" #include "displayapp/screens/Screen.h" #include "displayapp/screens/Symbols.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; @@ -123,8 +124,7 @@ calibrating = 1; vCalTime = xTaskGetTickCount(); lv_label_set_text_static(calLabel, "Ready!"); lv_obj_set_click(positionArc, false); - lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); - lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_MAKE(0x0, 0xb0, 0x0)); + lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, Colors::highlight); } else if (lv_btn_get_state(calButton) == LV_BTN_STATE_RELEASED) { calibrating = 0; lv_obj_set_click(positionArc, true); diff --git a/src/displayapp/screens/settings/SettingSteps.cpp b/src/displayapp/screens/settings/SettingSteps.cpp index e92600c2c70e84be99c4f5777d6a1798ca64e8a7..af5bd6e9118df7495059936ea6c05d4194674f60 100644 --- a/src/displayapp/screens/settings/SettingSteps.cpp +++ b/src/displayapp/screens/settings/SettingSteps.cpp @@ -17,7 +17,6 @@ : Screen(app), settingsController {settingsController} { lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); - // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5); diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp index 3cb2a364639554576a00ce30c9be4127092d9c4e..be595a74f14a9e74dac06ec39cf52163ceda8ac9 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.cpp +++ b/src/displayapp/screens/settings/SettingWatchFace.cpp @@ -21,7 +21,6 @@ : Screen(app), settingsController {settingsController} { lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); - // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5); diff --git a/src/displayapp/widgets/Counter.cpp b/src/displayapp/widgets/Counter.cpp index d8a1626e6e1f5d804801a390c9a194a9ea7d53a5..3c50a105d870391705082ca88e5ef8ef08924adf 100644 --- a/src/displayapp/widgets/Counter.cpp +++ b/src/displayapp/widgets/Counter.cpp @@ -1,5 +1,6 @@ #include "displayapp/widgets/Counter.h" #include "components/datetime/DateTimeController.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Widgets; @@ -108,10 +109,8 @@ this->ValueChangedHandler = handler; } void Counter::Create() { - constexpr lv_color_t bgColor = LV_COLOR_MAKE(0x38, 0x38, 0x38); - counterContainer = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(counterContainer, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, bgColor); + lv_obj_set_style_local_bg_color(counterContainer, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); number = lv_label_create(counterContainer, nullptr); lv_obj_set_style_local_text_font(number, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &font); @@ -133,7 +132,7 @@ UpdateLabel(); upBtn = lv_btn_create(counterContainer, nullptr); - lv_obj_set_style_local_bg_color(upBtn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, bgColor); + lv_obj_set_style_local_bg_color(upBtn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); lv_obj_set_size(upBtn, width, btnHeight); lv_obj_align(upBtn, nullptr, LV_ALIGN_IN_TOP_MID, 0, 0); upBtn->user_data = this; @@ -145,7 +144,7 @@ lv_label_set_text_static(upLabel, "+"); lv_obj_align(upLabel, nullptr, LV_ALIGN_CENTER, 0, 0); downBtn = lv_btn_create(counterContainer, nullptr); - lv_obj_set_style_local_bg_color(downBtn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, bgColor); + lv_obj_set_style_local_bg_color(downBtn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); lv_obj_set_size(downBtn, width, btnHeight); lv_obj_align(downBtn, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0); downBtn->user_data = this; diff --git a/src/displayapp/widgets/PageIndicator.cpp b/src/displayapp/widgets/PageIndicator.cpp index 06058beb1b3dab44a861ab17b963631b19a49233..84d03e7ed0b6191080653d07c6ba22971b84b361 100644 --- a/src/displayapp/widgets/PageIndicator.cpp +++ b/src/displayapp/widgets/PageIndicator.cpp @@ -1,4 +1,5 @@ #include "displayapp/widgets/PageIndicator.h" +#include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Widgets; @@ -13,7 +14,7 @@ pageIndicatorBasePoints[1].y = LV_VER_RES; pageIndicatorBase = lv_line_create(lv_scr_act(), nullptr); lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); - lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); + lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::bgDark); lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2); const int16_t indicatorSize = LV_VER_RES / nScreens; @@ -26,6 +27,6 @@ pageIndicatorPoints[1].y = indicatorPos + indicatorSize; pageIndicator = lv_line_create(lv_scr_act(), nullptr); lv_obj_set_style_local_line_width(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); - lv_obj_set_style_local_line_color(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0xb0, 0xb0, 0xb0)); + lv_obj_set_style_local_line_color(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); lv_line_set_points(pageIndicator, pageIndicatorPoints, 2); } diff --git a/src/displayapp/widgets/StatusIcons.cpp b/src/displayapp/widgets/StatusIcons.cpp index c1004b7702aaff73f5499a83086b3f269726d938..607f3745ae98313f33ca35853a30b09f4e4b8680 100644 --- a/src/displayapp/widgets/StatusIcons.cpp +++ b/src/displayapp/widgets/StatusIcons.cpp @@ -19,7 +19,7 @@ lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x0082FC)); lv_label_set_text_static(bleIcon, Screens::Symbols::bluetooth); batteryPlug = lv_label_create(container, nullptr); - lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFF0000)); + lv_obj_set_style_local_text_color(batteryPlug, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); lv_label_set_text_static(batteryPlug, Screens::Symbols::plug); batteryIcon.Create(container);