diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 093a3ac6ef..d045c5ec53 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -4,6 +4,7 @@ #include "components/brightness/BrightnessController.h" #include "components/fs/FS.h" #include "displayapp/apps/Apps.h" +#include "displayapp/Colors.h" #include namespace Pinetime { @@ -15,35 +16,15 @@ namespace Pinetime { enum class Notification : uint8_t { On, Off, Sleep }; enum class ChimesOption : uint8_t { None, Hours, HalfHours }; enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 }; - enum class Colors : uint8_t { - White, - Silver, - Gray, - Black, - Red, - Maroon, - Yellow, - Olive, - Lime, - Green, - Cyan, - Teal, - Blue, - Navy, - Magenta, - Purple, - Orange, - Pink - }; enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric }; enum class PTSWeather : uint8_t { On, Off }; enum class PrideFlag : uint8_t { Gay, Trans, Bi, Lesbian }; enum class DfuAndFsMode : uint8_t { Disabled, Enabled, EnabledTillReboot }; struct PineTimeStyle { - Colors ColorTime = Colors::Teal; - Colors ColorBar = Colors::Teal; - Colors ColorBG = Colors::Black; + Colors::Color ColorTime = Colors::Teal; + Colors::Color ColorBar = Colors::Teal; + Colors::Color ColorBG = Colors::Black; PTSGaugeStyle gaugeStyle = PTSGaugeStyle::Full; PTSWeather weatherEnable = PTSWeather::Off; }; @@ -85,33 +66,33 @@ namespace Pinetime { return settings.chimesOption; }; - void SetPTSColorTime(Colors colorTime) { + void SetPTSColorTime(Colors::Color colorTime) { if (colorTime != settings.PTS.ColorTime) settingsChanged = true; settings.PTS.ColorTime = colorTime; }; - Colors GetPTSColorTime() const { + Colors::Color GetPTSColorTime() const { return settings.PTS.ColorTime; }; - void SetPTSColorBar(Colors colorBar) { + void SetPTSColorBar(Colors::Color colorBar) { if (colorBar != settings.PTS.ColorBar) settingsChanged = true; settings.PTS.ColorBar = colorBar; }; - Colors GetPTSColorBar() const { + Colors::Color GetPTSColorBar() const { return settings.PTS.ColorBar; }; - void SetPTSColorBG(Colors colorBG) { + void SetPTSColorBG(Colors::Color colorBG) { if (colorBG != settings.PTS.ColorBG) settingsChanged = true; settings.PTS.ColorBG = colorBG; }; - Colors GetPTSColorBG() const { + Colors::Color GetPTSColorBG() const { return settings.PTS.ColorBG; }; diff --git a/src/displayapp/Colors.cpp b/src/displayapp/Colors.cpp index 2e9790eb45..bbb410c911 100644 --- a/src/displayapp/Colors.cpp +++ b/src/displayapp/Colors.cpp @@ -1,47 +1,10 @@ #include "displayapp/Colors.h" -using namespace Pinetime::Applications; -using namespace Pinetime::Controllers; +#include -lv_color_t Pinetime::Applications::Convert(Pinetime::Controllers::Settings::Colors color) { - switch (color) { - case Pinetime::Controllers::Settings::Colors::White: - return LV_COLOR_WHITE; - case Pinetime::Controllers::Settings::Colors::Silver: - return LV_COLOR_SILVER; - case Pinetime::Controllers::Settings::Colors::Gray: - return LV_COLOR_GRAY; - case Pinetime::Controllers::Settings::Colors::Black: - return LV_COLOR_BLACK; - case Pinetime::Controllers::Settings::Colors::Red: - return LV_COLOR_RED; - case Pinetime::Controllers::Settings::Colors::Maroon: - return LV_COLOR_MAKE(0xb0, 0x0, 0x0); - case Pinetime::Controllers::Settings::Colors::Yellow: - return LV_COLOR_YELLOW; - case Pinetime::Controllers::Settings::Colors::Olive: - return LV_COLOR_MAKE(0xb0, 0xb0, 0x0); - case Pinetime::Controllers::Settings::Colors::Lime: - return LV_COLOR_LIME; - case Pinetime::Controllers::Settings::Colors::Green: - return LV_COLOR_MAKE(0x0, 0xb0, 0x0); - case Pinetime::Controllers::Settings::Colors::Cyan: - return LV_COLOR_CYAN; - case Pinetime::Controllers::Settings::Colors::Teal: - return LV_COLOR_MAKE(0x0, 0xb0, 0xb0); - case Pinetime::Controllers::Settings::Colors::Blue: - return LV_COLOR_BLUE; - case Pinetime::Controllers::Settings::Colors::Navy: - return LV_COLOR_MAKE(0x0, 0x0, 0xb0); - case Pinetime::Controllers::Settings::Colors::Magenta: - return LV_COLOR_MAGENTA; - case Pinetime::Controllers::Settings::Colors::Purple: - return LV_COLOR_MAKE(0xb0, 0x0, 0xb0); - case Pinetime::Controllers::Settings::Colors::Orange: - return LV_COLOR_ORANGE; - case Pinetime::Controllers::Settings::Colors::Pink: - return LV_COLOR_MAKE(0xFF, 0xAE, 0xC9); - default: - return LV_COLOR_WHITE; - } +Colors::Color Colors::linear_gradient(Colors::Color startingColor, Colors::Color endingColor, uint8_t progress) { + constexpr decltype(progress) maxProgress = std::numeric_limits::max(); + return Colors::Color(((maxProgress - progress) * startingColor.red() + progress * endingColor.red()) / maxProgress, + ((maxProgress - progress) * startingColor.green() + progress * endingColor.green()) / maxProgress, + ((maxProgress - progress) * startingColor.blue() + progress * endingColor.blue()) / maxProgress); } diff --git a/src/displayapp/Colors.h b/src/displayapp/Colors.h index 43e2b80127..dfa54149df 100644 --- a/src/displayapp/Colors.h +++ b/src/displayapp/Colors.h @@ -1,10 +1,68 @@ #pragma once #include -#include "components/settings/Settings.h" -namespace Pinetime { - namespace Applications { - lv_color_t Convert(Controllers::Settings::Colors color); - } -} \ No newline at end of file +namespace Colors { + + class Color { + public: + constexpr Color(uint32_t color) : data {color} { + } + + constexpr operator uint32_t() const { + return data; + } + + constexpr Color(uint8_t r, uint8_t g, uint8_t b) + : data {(static_cast(r) << 16) | (static_cast(g) << 8) | static_cast(b)} { + } + + operator lv_color_t() const { + return lv_color_hex(data); + } + + uint8_t red() const { + return (data & 0xFF0000) >> 16; + } + + uint8_t green() const { + return (data & 0x00FF00) >> 8; + } + + uint8_t blue() const { + return (data & 0x0000FF); + } + + private: + uint32_t data; + }; + + Color linear_gradient(Color startingColor, Color endingColor, uint8_t progress); + + static constexpr Color White = 0xFFFFFF; + static constexpr Color Silver = 0xC0C0C0; + static constexpr Color LightGray = 0xB0B0B0; + static constexpr Color Gray = 0x808080; + static constexpr Color DarkGray = 0x1B1B1B; + static constexpr Color Black = 0x000000; + static constexpr Color Red = 0xFF0000; + static constexpr Color Maroon = 0xB00000; + static constexpr Color Yellow = 0xFFFF00; + static constexpr Color Olive = 0xB0B000; + static constexpr Color Lime = 0x00FF00; + static constexpr Color Green = 0x00B000; + static constexpr Color Cyan = 0x00FFFF; + static constexpr Color Teal = 0x00B0B0; + static constexpr Color Blue = 0x0000FF; + static constexpr Color Navy = 0x0000B0; + static constexpr Color Magenta = 0xFF00FF; + static constexpr Color Purple = 0xB000B0; + static constexpr Color Orange = 0xFFA500; + static constexpr Color DeepOrange = 0xFF4000; + static constexpr Color Pink = 0xFFAEC9; + static constexpr Color Platinum = 0xE5E5E2; + static constexpr Color Gold = 0xFFD700; + static constexpr Color Copper = 0xB87333; + static constexpr Color Violet = 0x6000FF; + static constexpr Color Aqua = 0x00FFF; +} diff --git a/src/displayapp/InfiniTimeTheme.cpp b/src/displayapp/InfiniTimeTheme.cpp index 6795647e1b..bb0df3def2 100644 --- a/src/displayapp/InfiniTimeTheme.cpp +++ b/src/displayapp/InfiniTimeTheme.cpp @@ -1,5 +1,6 @@ #include "displayapp/InfiniTimeTheme.h" #include +#include "displayapp/Colors.h" // Replace LV_DPX with a constexpr version using a constant LV_DPI #undef LV_DPX @@ -52,9 +53,11 @@ static void style_init_reset(lv_style_t* style) { } static void basic_init() { + using namespace Colors; + 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_bg_color(&style_bg, LV_STATE_DEFAULT, Black); lv_style_set_text_font(&style_bg, LV_STATE_DEFAULT, theme.font_normal); style_init_reset(&style_box); @@ -63,24 +66,24 @@ static void basic_init() { 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); + lv_style_set_text_color(&style_label_white, LV_STATE_DEFAULT, White); + lv_style_set_text_color(&style_label_white, LV_STATE_DISABLED, 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_bg_color(&style_btn, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bg); + lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, InfiniTimeTheme::Colors::highlight); + lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED, InfiniTimeTheme::Colors::bgDark); - 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_text_color(&style_btn, LV_STATE_DEFAULT, White); + lv_style_set_text_color(&style_btn, LV_STATE_DISABLED, Gray); lv_style_set_pad_all(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); lv_style_set_pad_inner(&style_btn, LV_STATE_DEFAULT, LV_DPX(15)); style_init_reset(&style_icon); - lv_style_set_text_color(&style_icon, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_text_color(&style_icon, LV_STATE_DEFAULT, White); style_init_reset(&style_bar_indic); lv_style_set_bg_opa(&style_bar_indic, LV_STATE_DEFAULT, LV_OPA_COVER); @@ -89,17 +92,17 @@ static void basic_init() { 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_bg_color(&style_scrollbar, LV_STATE_DEFAULT, 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_bg_color(&style_list_btn, LV_STATE_DEFAULT, White); + lv_style_set_text_color(&style_list_btn, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bg); + lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED, White); + lv_style_set_image_recolor(&style_list_btn, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bg); + lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED, 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); @@ -110,45 +113,45 @@ static void basic_init() { // 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_bg_color(&style_ddlist_list, LV_STATE_DEFAULT, 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); + lv_style_set_bg_color(&style_ddlist_selected, LV_STATE_DEFAULT, InfiniTimeTheme::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_bg_color(&style_sw_bg, LV_STATE_DEFAULT, InfiniTimeTheme::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); + lv_style_set_bg_color(&style_sw_indic, LV_STATE_DEFAULT, InfiniTimeTheme::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_bg_color(&style_sw_knob, LV_STATE_DEFAULT, Silver); + lv_style_set_bg_color(&style_sw_knob, LV_STATE_CHECKED, White); lv_style_set_radius(&style_sw_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); lv_style_set_pad_all(&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_bg_color(&style_slider_knob, LV_STATE_DEFAULT, Red); + lv_style_set_border_color(&style_slider_knob, LV_STATE_DEFAULT, 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_all(&style_slider_knob, LV_STATE_DEFAULT, 10); lv_style_set_pad_all(&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_color(&style_arc_indic, LV_STATE_DEFAULT, 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_color(&style_arc_bg, LV_STATE_DEFAULT, InfiniTimeTheme::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)); @@ -156,11 +159,11 @@ static void basic_init() { 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_bg_color(&style_arc_knob, LV_STATE_DEFAULT, 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_color(&style_table_cell, LV_STATE_DEFAULT, 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); @@ -181,14 +184,14 @@ static void basic_init() { 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_color(&style_lmeter, LV_STATE_DEFAULT, White); + lv_style_set_scale_grad_color(&style_lmeter, LV_STATE_DEFAULT, White); + lv_style_set_scale_end_color(&style_lmeter, LV_STATE_DEFAULT, 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_color(&style_chart_serie, LV_STATE_DEFAULT, 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); @@ -200,7 +203,7 @@ static void basic_init() { lv_style_reset(&style_cb_bullet); lv_style_set_radius(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(4)); lv_style_set_pattern_image(&style_cb_bullet, LV_STATE_CHECKED, LV_SYMBOL_OK); - lv_style_set_pattern_recolor(&style_cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE); + lv_style_set_pattern_recolor(&style_cb_bullet, LV_STATE_CHECKED, White); lv_style_set_pad_all(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); } @@ -216,8 +219,8 @@ static void basic_init() { * @return a pointer to reference this theme later */ lv_theme_t* lv_pinetime_theme_init() { - theme.color_primary = LV_COLOR_WHITE; - theme.color_secondary = LV_COLOR_GRAY; + theme.color_primary = Colors::White; + theme.color_secondary = Colors::Gray; theme.font_small = &jetbrains_mono_bold_20; theme.font_normal = &jetbrains_mono_bold_20; theme.font_subtitle = &jetbrains_mono_bold_20; diff --git a/src/displayapp/InfiniTimeTheme.h b/src/displayapp/InfiniTimeTheme.h index 0690b09912..14652178df 100644 --- a/src/displayapp/InfiniTimeTheme.h +++ b/src/displayapp/InfiniTimeTheme.h @@ -1,18 +1,15 @@ #pragma once #include +#include "displayapp/Colors.h" -namespace Colors { - static constexpr lv_color_t deepOrange = LV_COLOR_MAKE(0xff, 0x40, 0x0); - 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 blue = LV_COLOR_MAKE(0x0, 0x50, 0xff); - 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; +namespace InfiniTimeTheme { + namespace Colors { + static constexpr ::Colors::Color bg = 0x5d697e; + static constexpr ::Colors::Color bgAlt = 0x383838; + static constexpr ::Colors::Color bgDark = 0x181818; + static constexpr ::Colors::Color highlight = ::Colors::Green; + }; }; /** diff --git a/src/displayapp/screens/Alarm.cpp b/src/displayapp/screens/Alarm.cpp index 4cf4392157..d1e5199063 100644 --- a/src/displayapp/screens/Alarm.cpp +++ b/src/displayapp/screens/Alarm.cpp @@ -19,6 +19,7 @@ #include "displayapp/screens/Screen.h" #include "displayapp/screens/Symbols.h" #include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" #include "components/settings/Settings.h" #include "components/alarm/AlarmController.h" #include "components/motor/MotorController.h" @@ -79,12 +80,12 @@ Alarm::Alarm(Controllers::AlarmController& alarmController, lv_obj_set_event_cb(btnStop, btnEventHandler); lv_obj_set_size(btnStop, 240, 70); lv_obj_align(btnStop, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); - lv_obj_set_style_local_bg_color(btnStop, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_obj_set_style_local_bg_color(btnStop, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::Red); 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 = Colors::bgAlt; + static constexpr Colors::Color bgColor = InfiniTimeTheme::Colors::bgAlt; btnRecur = lv_btn_create(lv_scr_act(), nullptr); btnRecur->user_data = this; @@ -102,7 +103,7 @@ Alarm::Alarm(Controllers::AlarmController& alarmController, lv_obj_align(btnInfo, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, -4); lv_obj_set_style_local_bg_color(btnInfo, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, bgColor); lv_obj_set_style_local_border_width(btnInfo, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 4); - lv_obj_set_style_local_border_color(btnInfo, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_border_color(btnInfo, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::Black); lv_obj_t* txtInfo = lv_label_create(btnInfo, nullptr); lv_label_set_text_static(txtInfo, "i"); @@ -249,7 +250,7 @@ void Alarm::ShowInfo() { lv_obj_set_width(btnMessage, 150); lv_obj_align(btnMessage, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); txtMessage = lv_label_create(btnMessage, nullptr); - lv_obj_set_style_local_bg_color(btnMessage, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_NAVY); + lv_obj_set_style_local_bg_color(btnMessage, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::Navy); if (alarmController.IsEnabled()) { auto timeToAlarm = alarmController.SecondsToAlarm(); diff --git a/src/displayapp/screens/BatteryIcon.cpp b/src/displayapp/screens/BatteryIcon.cpp index 6194807d32..2cb1451675 100644 --- a/src/displayapp/screens/BatteryIcon.cpp +++ b/src/displayapp/screens/BatteryIcon.cpp @@ -11,7 +11,7 @@ BatteryIcon::BatteryIcon(bool colorOnLowBattery) : colorOnLowBattery {colorOnLow void BatteryIcon::Create(lv_obj_t* parent) { batteryImg = lv_img_create(parent, nullptr); lv_img_set_src(batteryImg, &batteryicon); - lv_obj_set_style_local_image_recolor(batteryImg, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_image_recolor(batteryImg, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, Colors::Black); batteryJuice = lv_obj_create(batteryImg, nullptr); lv_obj_set_width(batteryJuice, 8); @@ -30,16 +30,16 @@ void BatteryIcon::SetBatteryPercentage(uint8_t percentage) { static constexpr int lowBatteryThreshold = 15; static constexpr int criticalBatteryThreshold = 5; if (percentage > lowBatteryThreshold) { - SetColor(LV_COLOR_WHITE); + SetColor(Colors::White); } else if (percentage > criticalBatteryThreshold) { - SetColor(LV_COLOR_ORANGE); + SetColor(Colors::Orange); } else { - SetColor(Colors::deepOrange); + SetColor(Colors::DeepOrange); } } } -void BatteryIcon::SetColor(lv_color_t color) { +void BatteryIcon::SetColor(Colors::Color color) { lv_obj_set_style_local_image_recolor(batteryImg, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, color); lv_obj_set_style_local_image_recolor_opa(batteryImg, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER); lv_obj_set_style_local_bg_color(batteryJuice, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color); diff --git a/src/displayapp/screens/BatteryIcon.h b/src/displayapp/screens/BatteryIcon.h index 19fea967d9..e1bb1d9dad 100644 --- a/src/displayapp/screens/BatteryIcon.h +++ b/src/displayapp/screens/BatteryIcon.h @@ -1,6 +1,7 @@ #pragma once #include #include +#include "displayapp/Colors.h" namespace Pinetime { namespace Applications { @@ -10,7 +11,7 @@ namespace Pinetime { explicit BatteryIcon(bool colorOnLowBattery); void Create(lv_obj_t* parent); - void SetColor(lv_color_t); + void SetColor(Colors::Color); void SetBatteryPercentage(uint8_t percentage); lv_obj_t* GetObject(); diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp index 16845d53e7..4ded430252 100644 --- a/src/displayapp/screens/BatteryInfo.cpp +++ b/src/displayapp/screens/BatteryInfo.cpp @@ -18,10 +18,10 @@ BatteryInfo::BatteryInfo(const Pinetime::Controllers::Battery& batteryController lv_obj_align(chargingArc, nullptr, LV_ALIGN_CENTER, 0, -30); lv_arc_set_value(chargingArc, batteryPercent); lv_obj_set_style_local_bg_opa(chargingArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, LV_OPA_0); - lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); lv_obj_set_style_local_border_width(chargingArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 2); lv_obj_set_style_local_radius(chargingArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_LIME); + lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, Colors::Lime); status = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(status, "Reading Battery status"); @@ -35,7 +35,7 @@ BatteryInfo::BatteryInfo(const Pinetime::Controllers::Battery& batteryController lv_obj_align(percent, chargingArc, LV_ALIGN_CENTER, 0, 0); voltage = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(voltage, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange); + 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_IN_BOTTOM_MID, 0, -7); @@ -50,24 +50,25 @@ BatteryInfo::~BatteryInfo() { } void BatteryInfo::Refresh() { + using namespace Colors; batteryPercent = batteryController.PercentRemaining(); batteryVoltage = batteryController.Voltage(); if (batteryController.IsCharging()) { - lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_LIME); + lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, Lime); lv_label_set_text_static(status, "Charging"); } else if (batteryPercent == 100) { - lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_BLUE); + lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, Blue); lv_label_set_text_static(status, "Fully charged"); } else if (batteryPercent > 15) { - lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_GREEN); + lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, Green); lv_label_set_text_static(status, "Discharging"); } else if (batteryPercent > 5) { - lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, Orange); lv_label_set_text_static(status, "Battery low"); } else { - lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, Colors::deepOrange); + lv_obj_set_style_local_line_color(chargingArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, DeepOrange); lv_label_set_text_static(status, "Battery critical"); } diff --git a/src/displayapp/screens/Calculator.cpp b/src/displayapp/screens/Calculator.cpp index a1f093830c..53f06c1700 100644 --- a/src/displayapp/screens/Calculator.cpp +++ b/src/displayapp/screens/Calculator.cpp @@ -39,7 +39,7 @@ Calculator::Calculator() { lv_btnmatrix_set_map(buttonMatrix, const_cast(buttonMap)); lv_btnmatrix_set_one_check(buttonMatrix, true); lv_obj_set_size(buttonMatrix, 238, 180); - lv_obj_set_style_local_bg_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_bg_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); lv_obj_set_style_local_pad_inner(buttonMatrix, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 1); lv_obj_set_style_local_pad_top(buttonMatrix, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 1); lv_obj_set_style_local_pad_bottom(buttonMatrix, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 1); @@ -207,26 +207,26 @@ void Calculator::UpdateOperation() const { switch (operation) { case '+': lv_obj_set_style_local_bg_grad_dir(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, LV_GRAD_DIR_HOR); - lv_obj_set_style_local_bg_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::deepOrange); - lv_obj_set_style_local_bg_grad_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::bgAlt); + lv_obj_set_style_local_bg_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::DeepOrange); + lv_obj_set_style_local_bg_grad_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, InfiniTimeTheme::Colors::bgAlt); lv_btnmatrix_set_btn_ctrl(buttonMatrix, 7, LV_BTNMATRIX_CTRL_CHECK_STATE); break; case '-': lv_obj_set_style_local_bg_grad_dir(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, LV_GRAD_DIR_HOR); - lv_obj_set_style_local_bg_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::bgAlt); - lv_obj_set_style_local_bg_grad_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::deepOrange); + lv_obj_set_style_local_bg_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, InfiniTimeTheme::Colors::bgAlt); + lv_obj_set_style_local_bg_grad_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::DeepOrange); lv_btnmatrix_set_btn_ctrl(buttonMatrix, 7, LV_BTNMATRIX_CTRL_CHECK_STATE); break; case '*': lv_obj_set_style_local_bg_grad_dir(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, LV_GRAD_DIR_HOR); - lv_obj_set_style_local_bg_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::deepOrange); - lv_obj_set_style_local_bg_grad_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::bgAlt); + lv_obj_set_style_local_bg_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::DeepOrange); + lv_obj_set_style_local_bg_grad_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, InfiniTimeTheme::Colors::bgAlt); lv_btnmatrix_set_btn_ctrl(buttonMatrix, 11, LV_BTNMATRIX_CTRL_CHECK_STATE); break; case '/': lv_obj_set_style_local_bg_grad_dir(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, LV_GRAD_DIR_HOR); - lv_obj_set_style_local_bg_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::bgAlt); - lv_obj_set_style_local_bg_grad_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::deepOrange); + lv_obj_set_style_local_bg_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, InfiniTimeTheme::Colors::bgAlt); + lv_obj_set_style_local_bg_grad_color(buttonMatrix, LV_BTNMATRIX_PART_BTN, LV_STATE_CHECKED, Colors::DeepOrange); lv_btnmatrix_set_btn_ctrl(buttonMatrix, 11, LV_BTNMATRIX_CTRL_CHECK_STATE); break; default: diff --git a/src/displayapp/screens/CheckboxList.cpp b/src/displayapp/screens/CheckboxList.cpp index 9eb80bbad4..f30c81ae66 100644 --- a/src/displayapp/screens/CheckboxList.cpp +++ b/src/displayapp/screens/CheckboxList.cpp @@ -24,7 +24,7 @@ CheckboxList::CheckboxList(const uint8_t screenID, value {originalValue}, pageIndicator(screenID, numScreens) { // Set the background to Black - lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, Colors::Black); if (numScreens > 1) { pageIndicator.Create(); @@ -48,7 +48,7 @@ CheckboxList::CheckboxList(const uint8_t screenID, lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15); lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Orange); lv_label_set_text_static(icon, optionsSymbol); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); diff --git a/src/displayapp/screens/Dice.cpp b/src/displayapp/screens/Dice.cpp index 302c5f3fb2..2753823ff8 100644 --- a/src/displayapp/screens/Dice.cpp +++ b/src/displayapp/screens/Dice.cpp @@ -9,7 +9,7 @@ using namespace Pinetime::Applications::Screens; namespace { lv_obj_t* MakeLabel(lv_font_t* font, - lv_color_t color, + Colors::Color color, lv_label_long_mode_t longMode, uint8_t width, lv_label_align_t labelAlignment, @@ -50,7 +50,7 @@ Dice::Dice(Controllers::MotionController& motionController, gen.seed(sseq); lv_obj_t* nCounterLabel = MakeLabel(&jetbrains_mono_bold_20, - LV_COLOR_WHITE, + Colors::White, LV_LABEL_LONG_EXPAND, 0, LV_LABEL_ALIGN_CENTER, @@ -61,7 +61,7 @@ Dice::Dice(Controllers::MotionController& motionController, 0); lv_obj_t* dCounterLabel = MakeLabel(&jetbrains_mono_bold_20, - LV_COLOR_WHITE, + Colors::White, LV_LABEL_LONG_EXPAND, 0, LV_LABEL_ALIGN_CENTER, @@ -113,7 +113,7 @@ Dice::Dice(Controllers::MotionController& motionController, lv_obj_align(btnRoll, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); btnRollLabel = MakeLabel(&jetbrains_mono_bold_20, - LV_COLOR_WHITE, + Colors::White, LV_LABEL_LONG_EXPAND, 0, LV_LABEL_ALIGN_CENTER, diff --git a/src/displayapp/screens/Dice.h b/src/displayapp/screens/Dice.h index d12848d3cf..d52e7093a3 100644 --- a/src/displayapp/screens/Dice.h +++ b/src/displayapp/screens/Dice.h @@ -4,6 +4,7 @@ #include "displayapp/screens/Screen.h" #include "displayapp/widgets/Counter.h" #include "displayapp/Controllers.h" +#include "displayapp/Colors.h" #include "Symbols.h" #include @@ -31,7 +32,7 @@ namespace Pinetime { std::mt19937 gen; - std::array resultColors = {LV_COLOR_YELLOW, LV_COLOR_MAGENTA, LV_COLOR_AQUA}; + std::array resultColors = {Colors::Yellow, Colors::Magenta, Colors::Aqua}; uint8_t currentColorIndex; void NextColor(); diff --git a/src/displayapp/screens/Error.cpp b/src/displayapp/screens/Error.cpp index 6f826b873b..caca890206 100644 --- a/src/displayapp/screens/Error.cpp +++ b/src/displayapp/screens/Error.cpp @@ -1,5 +1,7 @@ #include "displayapp/screens/Error.h" +#include "displayapp/Colors.h" + using namespace Pinetime::Applications::Screens; namespace { @@ -12,7 +14,7 @@ namespace { Error::Error(System::BootErrors error) { lv_obj_t* warningLabel = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(warningLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_text_color(warningLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Orange); lv_label_set_text_static(warningLabel, "Warning"); lv_obj_align(warningLabel, nullptr, LV_ALIGN_IN_TOP_MID, 0, 0); @@ -38,7 +40,7 @@ Error::Error(System::BootErrors error) { lv_obj_align(btnOk, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_t* lblOk = lv_label_create(btnOk, nullptr); lv_label_set_text_static(lblOk, "Proceed"); - lv_obj_set_style_local_bg_color(btnOk, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_bg_color(btnOk, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::Orange); } void Error::ButtonEventHandler() { diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp index 7d00ef3921..54b9e1d6e3 100644 --- a/src/displayapp/screens/FirmwareUpdate.cpp +++ b/src/displayapp/screens/FirmwareUpdate.cpp @@ -13,7 +13,7 @@ FirmwareUpdate::FirmwareUpdate(const Pinetime::Controllers::Ble& bleController) lv_obj_align(titleLabel, nullptr, LV_ALIGN_IN_TOP_MID, 0, 50); bar1 = lv_bar_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(bar1, LV_BAR_PART_BG, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_bg_color(bar1, LV_BAR_PART_BG, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); lv_obj_set_style_local_bg_opa(bar1, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_OPA_100); lv_obj_set_style_local_radius(bar1, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); lv_obj_set_size(bar1, 200, 30); diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index 2a9919d532..ba5130890c 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -42,7 +42,7 @@ FirmwareValidation::FirmwareValidation(Pinetime::Controllers::FirmwareValidator& lv_obj_set_size(buttonValidate, 115, 50); lv_obj_align(buttonValidate, nullptr, 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, Colors::highlight); + lv_obj_set_style_local_bg_color(buttonValidate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::highlight); labelButtonValidate = lv_label_create(buttonValidate, nullptr); lv_label_set_text_static(labelButtonValidate, "Validate"); @@ -51,7 +51,7 @@ FirmwareValidation::FirmwareValidation(Pinetime::Controllers::FirmwareValidator& 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_RED); + lv_obj_set_style_local_bg_color(buttonReset, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::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 7e0caff16d..3b604c528d 100644 --- a/src/displayapp/screens/FlashLight.cpp +++ b/src/displayapp/screens/FlashLight.cpp @@ -1,7 +1,7 @@ #include "displayapp/screens/FlashLight.h" #include "displayapp/DisplayApp.h" #include "displayapp/screens/Symbols.h" -#include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" using namespace Pinetime::Applications::Screens; @@ -52,13 +52,13 @@ FlashLight::FlashLight(System::SystemTask& systemTask, Controllers::BrightnessCo FlashLight::~FlashLight() { lv_obj_clean(lv_scr_act()); - lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, Colors::Black); brightnessController.Set(previousBrightnessLevel); } void FlashLight::SetColors() { - lv_color_t bgColor = isOn ? LV_COLOR_WHITE : LV_COLOR_BLACK; - lv_color_t fgColor = isOn ? Colors::lightGray : LV_COLOR_WHITE; + Colors::Color bgColor = isOn ? Colors::White : Colors::Black; + Colors::Color fgColor = isOn ? Colors::LightGray : Colors::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 1a84d34928..a24fba7991 100644 --- a/src/displayapp/screens/HeartRate.cpp +++ b/src/displayapp/screens/HeartRate.cpp @@ -4,6 +4,7 @@ #include "displayapp/DisplayApp.h" #include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" using namespace Pinetime::Applications::Screens; @@ -36,9 +37,9 @@ HeartRate::HeartRate(Controllers::HeartRateController& heartRateController, Syst 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, Colors::highlight); + lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::highlight); } else { - lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); + 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, "---"); @@ -49,7 +50,7 @@ HeartRate::HeartRate(Controllers::HeartRateController& heartRateController, Syst lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20); label_status = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); + lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Gray); lv_label_set_text_static(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData)); lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); @@ -101,12 +102,12 @@ void HeartRate::OnStartStopEvent(lv_event_t event) { heartRateController.Start(); UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped); wakeLock.Lock(); - lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight); + lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::highlight); } else { heartRateController.Stop(); UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped); wakeLock.Release(); - lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); + 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 1d6be97930..4ccb62f17a 100644 --- a/src/displayapp/screens/InfiniPaint.cpp +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -1,7 +1,7 @@ #include "displayapp/screens/InfiniPaint.h" #include "displayapp/DisplayApp.h" #include "displayapp/LittleVgl.h" -#include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" #include // std::fill @@ -9,7 +9,7 @@ using namespace Pinetime::Applications::Screens; InfiniPaint::InfiniPaint(Pinetime::Components::LittleVgl& lvgl, Pinetime::Controllers::MotorController& motor) : lvgl {lvgl}, motor {motor} { - std::fill(b, b + bufferSize, selectColor); + std::fill(b, b + bufferSize, static_cast(selectColor)); } InfiniPaint::~InfiniPaint() { @@ -22,28 +22,28 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { color = (color + 1) % 8; switch (color) { case 0: - selectColor = LV_COLOR_MAGENTA; + selectColor = Colors::Magenta; break; case 1: - selectColor = Colors::green; + selectColor = Colors::Green; break; case 2: - selectColor = LV_COLOR_WHITE; + selectColor = Colors::White; break; case 3: - selectColor = LV_COLOR_RED; + selectColor = Colors::Red; break; case 4: - selectColor = LV_COLOR_CYAN; + selectColor = Colors::Cyan; break; case 5: - selectColor = LV_COLOR_YELLOW; + selectColor = Colors::Yellow; break; case 6: - selectColor = LV_COLOR_BLUE; + selectColor = Colors::Blue; break; case 7: - selectColor = LV_COLOR_BLACK; + selectColor = Colors::Black; break; default: @@ -51,7 +51,7 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { break; } - std::fill(b, b + bufferSize, selectColor); + std::fill(b, b + bufferSize, static_cast(selectColor)); motor.RunForDuration(35); return true; default: diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h index 06552abb2e..728d0f0799 100644 --- a/src/displayapp/screens/InfiniPaint.h +++ b/src/displayapp/screens/InfiniPaint.h @@ -7,6 +7,7 @@ #include "components/motor/MotorController.h" #include "Symbols.h" #include "displayapp/apps/Apps.h" +#include "displayapp/Colors.h" #include namespace Pinetime { @@ -34,7 +35,7 @@ namespace Pinetime { static constexpr uint16_t height = 10; static constexpr uint16_t bufferSize = width * height; lv_color_t b[bufferSize]; - lv_color_t selectColor = LV_COLOR_WHITE; + Colors::Color selectColor = Colors::White; uint8_t color = 2; }; } diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp index 264b4fc98b..dbabcb9939 100644 --- a/src/displayapp/screens/List.cpp +++ b/src/displayapp/screens/List.cpp @@ -20,7 +20,7 @@ List::List(uint8_t screenID, : app {app}, settingsController {settingsController}, pageIndicator(screenID, numScreens) { // Set the background to Black - lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0, 0, 0)); + lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, Colors::Black); settingsController.SetSettingsMenu(screenID); @@ -45,7 +45,7 @@ List::List(uint8_t screenID, static constexpr int btnHeight = (LV_HOR_RES_MAX - ((MAXLISTITEMS - 1) * innerPad)) / MAXLISTITEMS; itemApps[i] = lv_btn_create(container, nullptr); lv_obj_set_style_local_radius(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, btnHeight / 3); - lv_obj_set_style_local_bg_color(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_bg_color(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); lv_obj_set_width(itemApps[i], LV_HOR_RES - 8); lv_obj_set_height(itemApps[i], btnHeight); lv_obj_set_event_cb(itemApps[i], ButtonEventHandler); @@ -54,7 +54,7 @@ List::List(uint8_t screenID, lv_obj_set_style_local_clip_corner(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, true); lv_obj_t* icon = lv_label_create(itemApps[i], nullptr); - lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); + lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Yellow); lv_label_set_text_static(icon, applications[i].icon); lv_label_set_long_mode(icon, LV_LABEL_LONG_CROP); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); diff --git a/src/displayapp/screens/Metronome.cpp b/src/displayapp/screens/Metronome.cpp index 6b758470a4..aa16717517 100644 --- a/src/displayapp/screens/Metronome.cpp +++ b/src/displayapp/screens/Metronome.cpp @@ -1,6 +1,6 @@ #include "displayapp/screens/Metronome.h" #include "displayapp/screens/Symbols.h" -#include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" using namespace Pinetime::Applications::Screens; @@ -13,7 +13,7 @@ namespace { 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, Colors::lightGray); + 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 ecbed317c7..73450036df 100644 --- a/src/displayapp/screens/Motion.cpp +++ b/src/displayapp/screens/Motion.cpp @@ -1,7 +1,7 @@ #include "displayapp/screens/Motion.h" #include #include "displayapp/DisplayApp.h" -#include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" using namespace Pinetime::Applications::Screens; @@ -18,9 +18,9 @@ Motion::Motion(Controllers::MotionController& motionController) : motionControll 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, Colors::green); - ser3 = lv_chart_add_series(chart, LV_COLOR_YELLOW); + ser1 = lv_chart_add_series(chart, Colors::Red); + ser2 = lv_chart_add_series(chart, Colors::Green); + ser3 = lv_chart_add_series(chart, Colors::Yellow); lv_chart_init_points(chart, ser1, 0); lv_chart_init_points(chart, ser2, 0); diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index 0bd0965ff9..27b94fd539 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -53,7 +53,7 @@ Music::Music(Pinetime::Controllers::MusicService& music) : musicService(music) { lv_style_init(&btn_style); lv_style_set_radius(&btn_style, LV_STATE_DEFAULT, 20); - lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, Colors::bgAlt); + lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); btnVolDown = lv_btn_create(lv_scr_act(), nullptr); btnVolDown->user_data = this; @@ -118,7 +118,7 @@ Music::Music(Pinetime::Controllers::MusicService& music) : musicService(music) { lv_label_set_align(txtArtist, LV_ALIGN_IN_LEFT_MID); lv_obj_set_width(txtArtist, LV_HOR_RES - 12); lv_label_set_text_static(txtArtist, ""); - lv_obj_set_style_local_text_color(txtArtist, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); + lv_obj_set_style_local_text_color(txtArtist, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::LightGray); txtTrack = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL_CIRC); diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp index ee9f2a0002..d9b6183041 100644 --- a/src/displayapp/screens/Navigation.cpp +++ b/src/displayapp/screens/Navigation.cpp @@ -191,6 +191,8 @@ namespace { * */ Navigation::Navigation(Pinetime::Controllers::NavigationService& nav) : navService(nav) { + using namespace Colors; + const auto& image = GetIcon("flag"); imgFlag = lv_img_create(lv_scr_act(), nullptr); lv_img_set_auto_size(imgFlag, false); @@ -199,7 +201,7 @@ Navigation::Navigation(Pinetime::Controllers::NavigationService& nav) : navServi lv_img_set_offset_x(imgFlag, 0); lv_img_set_offset_y(imgFlag, image.offset); lv_obj_set_style_local_image_recolor_opa(imgFlag, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_obj_set_style_local_image_recolor(imgFlag, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN); + lv_obj_set_style_local_image_recolor(imgFlag, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, Cyan); lv_obj_align(imgFlag, nullptr, LV_ALIGN_CENTER, 0, -60); txtNarrative = lv_label_create(lv_scr_act(), nullptr); @@ -212,7 +214,7 @@ Navigation::Navigation(Pinetime::Controllers::NavigationService& nav) : navServi txtManDist = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(txtManDist, LV_LABEL_LONG_BREAK); - lv_obj_set_style_local_text_color(txtManDist, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); + lv_obj_set_style_local_text_color(txtManDist, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Green); lv_obj_set_style_local_text_font(txtManDist, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); lv_obj_set_width(txtManDist, LV_HOR_RES); lv_label_set_text_static(txtManDist, "--M"); @@ -223,8 +225,8 @@ Navigation::Navigation(Pinetime::Controllers::NavigationService& nav) : navServi barProgress = lv_bar_create(lv_scr_act(), nullptr); lv_obj_set_size(barProgress, 200, 20); lv_obj_align(barProgress, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, -10); - lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_BG, LV_STATE_DEFAULT, lv_color_hex(0x222222)); - lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_BG, LV_STATE_DEFAULT, Colors::Color(0x222222)); + lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, Orange); lv_bar_set_anim_time(barProgress, 500); lv_bar_set_range(barProgress, 0, 100); lv_bar_set_value(barProgress, 0, LV_ANIM_OFF); @@ -238,12 +240,13 @@ Navigation::~Navigation() { } void Navigation::Refresh() { + using namespace Colors; if (flag != navService.getFlag()) { flag = navService.getFlag(); const auto& image = GetIcon(flag); lv_img_set_src(imgFlag, image.fileName); lv_obj_set_style_local_image_recolor_opa(imgFlag, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_obj_set_style_local_image_recolor(imgFlag, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN); + lv_obj_set_style_local_image_recolor(imgFlag, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, Cyan); lv_img_set_offset_y(imgFlag, image.offset); } @@ -261,9 +264,9 @@ void Navigation::Refresh() { progress = navService.getProgress(); 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); + lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, Red); } else { - lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, Colors::orange); + lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, Orange); } } } diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 837c4683aa..75194b90da 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -5,6 +5,7 @@ #include "displayapp/screens/Symbols.h" #include #include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; @@ -50,7 +51,7 @@ Notifications::Notifications(DisplayApp* app, timeoutLine = lv_line_create(lv_scr_act(), nullptr); lv_obj_set_style_local_line_width(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); - lv_obj_set_style_local_line_color(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_line_color(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::White); lv_obj_set_style_local_line_rounded(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true); lv_line_set_points(timeoutLine, timeoutLinePoints, 2); @@ -133,7 +134,7 @@ void Notifications::DismissToBlack() { // create black transition screen to let the notification dismiss to blackness lv_obj_t* blackBox = lv_obj_create(lv_scr_act(), nullptr); lv_obj_set_size(blackBox, LV_HOR_RES, LV_VER_RES); - lv_obj_set_style_local_bg_color(blackBox, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(blackBox, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, Colors::Black); dismissingNotification = true; } @@ -265,13 +266,13 @@ Notifications::NotificationItem::NotificationItem(const char* title, : alertNotificationService {alertNotificationService}, motorController {motorController} { container = lv_cont_create(lv_scr_act(), nullptr); lv_obj_set_size(container, LV_HOR_RES, LV_VER_RES); - lv_obj_set_style_local_bg_color(container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, Colors::Black); lv_obj_set_style_local_pad_all(container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 0); 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, Colors::bgAlt); + lv_obj_set_style_local_bg_color(subject_container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::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); @@ -286,7 +287,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_align(alert_count, nullptr, 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, Colors::orange); + 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 { @@ -328,7 +329,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_align(bt_accept, nullptr, 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, Colors::highlight); + lv_obj_set_style_local_bg_color(bt_accept, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::highlight); bt_reject = lv_btn_create(container, nullptr); bt_reject->user_data = this; @@ -337,7 +338,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_align(bt_reject, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0); label_reject = lv_label_create(bt_reject, nullptr); lv_label_set_text_static(label_reject, Symbols::phoneSlash); - lv_obj_set_style_local_bg_color(bt_reject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_obj_set_style_local_bg_color(bt_reject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Red); bt_mute = lv_btn_create(container, nullptr); bt_mute->user_data = this; @@ -346,7 +347,7 @@ Notifications::NotificationItem::NotificationItem(const char* title, lv_obj_align(bt_mute, nullptr, 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, Colors::lightGray); + 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/Paddle.cpp b/src/displayapp/screens/Paddle.cpp index 00298eca9a..8866c76e1a 100644 --- a/src/displayapp/screens/Paddle.cpp +++ b/src/displayapp/screens/Paddle.cpp @@ -7,12 +7,13 @@ using namespace Pinetime::Applications::Screens; Paddle::Paddle(Pinetime::Components::LittleVgl& lvgl) : lvgl {lvgl} { + using namespace Colors; background = lv_obj_create(lv_scr_act(), nullptr); lv_obj_set_size(background, LV_HOR_RES + 1, LV_VER_RES); lv_obj_set_pos(background, -1, 0); lv_obj_set_style_local_radius(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_bg_color(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_border_color(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_bg_color(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Black); + lv_obj_set_style_local_border_color(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, White); lv_obj_set_style_local_border_width(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 1); points = lv_label_create(lv_scr_act(), nullptr); @@ -21,12 +22,12 @@ Paddle::Paddle(Pinetime::Components::LittleVgl& lvgl) : lvgl {lvgl} { lv_obj_align(points, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 10); paddle = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(paddle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_bg_color(paddle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, White); lv_obj_set_style_local_radius(paddle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); lv_obj_set_size(paddle, 4, 60); ball = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(ball, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_bg_color(ball, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, White); lv_obj_set_style_local_radius(ball, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); lv_obj_set_size(ball, ballSize, ballSize); diff --git a/src/displayapp/screens/PassKey.cpp b/src/displayapp/screens/PassKey.cpp index 78e51caaa6..15f51d62aa 100644 --- a/src/displayapp/screens/PassKey.cpp +++ b/src/displayapp/screens/PassKey.cpp @@ -5,7 +5,7 @@ using namespace Pinetime::Applications::Screens; PassKey::PassKey(uint32_t key) { 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_YELLOW); + lv_obj_set_style_local_text_color(passkeyLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::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 c5faaf050a..8acdb55a70 100644 --- a/src/displayapp/screens/Steps.cpp +++ b/src/displayapp/screens/Steps.cpp @@ -2,6 +2,7 @@ #include #include "displayapp/DisplayApp.h" #include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" using namespace Pinetime::Applications::Screens; @@ -12,14 +13,15 @@ static void lap_event_handler(lv_obj_t* obj, lv_event_t event) { Steps::Steps(Controllers::MotionController& motionController, Controllers::Settings& settingsController) : motionController {motionController}, settingsController {settingsController} { + using namespace Colors; stepsArc = lv_arc_create(lv_scr_act(), nullptr); lv_obj_set_style_local_bg_opa(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, LV_OPA_0); - lv_obj_set_style_local_line_color(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_line_color(stepsArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); 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, Colors::blue); + lv_obj_set_style_local_line_color(stepsArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, Blue); lv_arc_set_end_angle(stepsArc, 200); lv_obj_set_size(stepsArc, 240, 240); lv_arc_set_range(stepsArc, 0, 500); @@ -31,18 +33,18 @@ Steps::Steps(Controllers::MotionController& motionController, Controllers::Setti 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_LIME); + lv_obj_set_style_local_text_color(lSteps, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, 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); lv_obj_t* lstepsL = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(lstepsL, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); + lv_obj_set_style_local_text_color(lstepsL, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LightGray); lv_label_set_text_static(lstepsL, "Steps"); lv_obj_align(lstepsL, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 5); lv_obj_t* lstepsGoal = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(lstepsGoal, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN); + lv_obj_set_style_local_text_color(lstepsGoal, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Cyan); lv_label_set_text_fmt(lstepsGoal, "Goal: %5lu", settingsController.GetStepsGoal()); lv_label_set_align(lstepsGoal, LV_LABEL_ALIGN_CENTER); lv_obj_align(lstepsGoal, lSteps, LV_ALIGN_OUT_BOTTOM_MID, 0, 40); @@ -52,7 +54,7 @@ Steps::Steps(Controllers::MotionController& motionController, Controllers::Setti lv_obj_set_event_cb(resetBtn, lap_event_handler); lv_obj_set_size(resetBtn, 120, 50); lv_obj_set_style_local_radius(resetBtn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_obj_set_style_local_bg_color(resetBtn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_bg_color(resetBtn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); lv_obj_align(resetBtn, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); resetButtonLabel = lv_label_create(resetBtn, nullptr); lv_label_set_text_static(resetButtonLabel, "Reset"); @@ -60,7 +62,7 @@ Steps::Steps(Controllers::MotionController& motionController, Controllers::Setti currentTripSteps = motionController.GetTripSteps(); tripLabel = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(tripLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); + lv_obj_set_style_local_text_color(tripLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Yellow); lv_label_set_text_fmt(tripLabel, "Trip: %5li", currentTripSteps); lv_obj_align(tripLabel, lstepsGoal, LV_ALIGN_IN_LEFT_MID, 0, 20); diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index ff852beb69..8c777e303c 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -2,6 +2,7 @@ #include "displayapp/screens/Symbols.h" #include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" using namespace Pinetime::Applications::Screens; @@ -54,7 +55,7 @@ StopWatch::StopWatch(System::SystemTask& systemTask) : wakeLock(systemTask) { lv_obj_set_state(txtStopLap, LV_STATE_DISABLED); lapText = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(lapText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); + lv_obj_set_style_local_text_color(lapText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::LightGray); lv_label_set_text_static(lapText, "\n"); lv_label_set_long_mode(lapText, LV_LABEL_LONG_BREAK); lv_label_set_align(lapText, LV_LABEL_ALIGN_CENTER); @@ -63,13 +64,13 @@ StopWatch::StopWatch(System::SystemTask& systemTask) : wakeLock(systemTask) { msecTime = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(msecTime, "00"); - lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DISABLED, Colors::lightGray); + lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DISABLED, Colors::LightGray); lv_obj_align(msecTime, lapText, LV_ALIGN_OUT_TOP_MID, 0, 0); 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_label_set_text_static(time, "00:00"); - lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DISABLED, Colors::lightGray); + lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DISABLED, Colors::LightGray); lv_obj_align(time, msecTime, LV_ALIGN_OUT_TOP_MID, 0, 0); SetInterfaceStopped(); @@ -83,8 +84,8 @@ StopWatch::~StopWatch() { } void StopWatch::SetInterfacePaused() { - lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); - lv_obj_set_style_local_bg_color(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::blue); + lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::Red); + lv_obj_set_style_local_bg_color(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::Blue); lv_label_set_text_static(txtPlayPause, Symbols::play); lv_label_set_text_static(txtStopLap, Symbols::stop); } @@ -92,8 +93,8 @@ void StopWatch::SetInterfacePaused() { void StopWatch::SetInterfaceRunning() { lv_obj_set_state(time, LV_STATE_DEFAULT); lv_obj_set_state(msecTime, LV_STATE_DEFAULT); - lv_obj_set_style_local_bg_color(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); - lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_bg_color(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); + lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); lv_label_set_text_static(txtPlayPause, Symbols::pause); lv_label_set_text_static(txtStopLap, Symbols::lapsFlag); @@ -105,7 +106,7 @@ void StopWatch::SetInterfaceRunning() { void StopWatch::SetInterfaceStopped() { lv_obj_set_state(time, LV_STATE_DISABLED); lv_obj_set_state(msecTime, LV_STATE_DISABLED); - lv_obj_set_style_local_bg_color(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::blue); + lv_obj_set_style_local_bg_color(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::Blue); lv_label_set_text_static(time, "00:00"); lv_label_set_text_static(msecTime, "00"); diff --git a/src/displayapp/screens/Styles.cpp b/src/displayapp/screens/Styles.cpp index cebdc70cc6..c78922b2ee 100644 --- a/src/displayapp/screens/Styles.cpp +++ b/src/displayapp/screens/Styles.cpp @@ -4,6 +4,6 @@ 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, Colors::highlight); - lv_obj_set_style_local_bg_color(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_CHECKED, LV_COLOR_WHITE); + lv_obj_set_style_local_border_color(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_CHECKED, InfiniTimeTheme::Colors::highlight); + lv_obj_set_style_local_bg_color(checkbox, LV_CHECKBOX_PART_BULLET, LV_STATE_CHECKED, Colors::White); } diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index 2392f3be3e..89e19ed5f9 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -13,7 +13,7 @@ #include "components/datetime/DateTimeController.h" #include "components/motion/MotionController.h" #include "drivers/Watchdog.h" -#include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" using namespace Pinetime::Applications::Screens; @@ -229,7 +229,7 @@ std::unique_ptr SystemInfo::CreateScreen4() { 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, Colors::lightGray); + 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 45f715b55a..83448d2cad 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -70,9 +70,9 @@ Tile::Tile(uint8_t screenID, lv_obj_align(btnm1, nullptr, LV_ALIGN_CENTER, 0, 10); lv_obj_set_style_local_radius(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, 20); - lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); 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, Colors::bgDark); + lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, InfiniTimeTheme::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 31cde73392..95ce0fa705 100644 --- a/src/displayapp/screens/Timer.cpp +++ b/src/displayapp/screens/Timer.cpp @@ -21,7 +21,7 @@ Timer::Timer(Controllers::Timer& timerController) : timer {timerController} { lv_obj_t* colonLabel = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(colonLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); - lv_obj_set_style_local_text_color(colonLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_text_color(colonLabel, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::White); lv_label_set_text_static(colonLabel, ":"); lv_obj_align(colonLabel, lv_scr_act(), LV_ALIGN_CENTER, 0, -29); @@ -41,7 +41,7 @@ Timer::Timer(Controllers::Timer& timerController) : timer {timerController} { lv_obj_t* btnHighlight = lv_obj_create(highlightObjectMask, nullptr); lv_obj_set_style_local_radius(btnHighlight, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_obj_set_style_local_bg_color(btnHighlight, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_bg_color(btnHighlight, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::Orange); lv_obj_set_size(btnHighlight, LV_HOR_RES, 50); lv_obj_align(btnHighlight, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); @@ -55,7 +55,7 @@ Timer::Timer(Controllers::Timer& timerController) : timer {timerController} { 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, Colors::bgAlt); + lv_obj_set_style_local_bg_color(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); lv_obj_set_event_cb(btnPlayPause, btnEventHandler); lv_obj_set_size(btnPlayPause, LV_HOR_RES, 50); diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp index 6f2eff40c4..a6b5ec7bce 100644 --- a/src/displayapp/screens/Twos.cpp +++ b/src/displayapp/screens/Twos.cpp @@ -2,22 +2,23 @@ #include #include #include +#include "displayapp/Colors.h" using namespace Pinetime::Applications::Screens; Twos::Twos() { struct colorPair { - lv_color_t bg; - lv_color_t fg; + Colors::Color bg; + Colors::Color fg; }; static constexpr colorPair colors[nColors] = { - {LV_COLOR_MAKE(0xcd, 0xc0, 0xb4), LV_COLOR_BLACK}, - {LV_COLOR_MAKE(0xef, 0xdf, 0xc6), LV_COLOR_BLACK}, - {LV_COLOR_MAKE(0xef, 0x92, 0x63), LV_COLOR_WHITE}, - {LV_COLOR_MAKE(0xf7, 0x61, 0x42), LV_COLOR_WHITE}, - {LV_COLOR_MAKE(0x00, 0x7d, 0xc5), LV_COLOR_WHITE}, + {0xcdc0b4, Colors::Black}, + {0xefdfc6, Colors::Black}, + {0xef9263, Colors::White}, + {0xf76142, Colors::White}, + {0x007dc5, Colors::White}, }; gridDisplay = lv_table_create(lv_scr_act(), nullptr); @@ -25,7 +26,7 @@ Twos::Twos() { for (size_t i = 0; i < nColors; i++) { lv_style_init(&cellStyles[i]); - lv_style_set_border_color(&cellStyles[i], LV_STATE_DEFAULT, lv_color_hex(0xbbada0)); + lv_style_set_border_color(&cellStyles[i], LV_STATE_DEFAULT, Colors::Color(0xbbada0)); lv_style_set_border_width(&cellStyles[i], LV_STATE_DEFAULT, 3); lv_style_set_bg_opa(&cellStyles[i], LV_STATE_DEFAULT, LV_OPA_COVER); lv_style_set_bg_color(&cellStyles[i], LV_STATE_DEFAULT, colors[i].bg); diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 3a7a00fae5..270ecc4d48 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -56,6 +56,7 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, bleController {bleController}, notificationManager {notificationManager}, settingsController {settingsController} { + using namespace Colors; sHour = 99; sMinute = 99; @@ -69,7 +70,7 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, lv_obj_set_style_local_bg_opa(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_scale_width(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4); lv_obj_set_style_local_scale_end_line_width(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 1); - lv_obj_set_style_local_scale_end_color(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); + lv_obj_set_style_local_scale_end_color(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, Gray); major_scales = lv_linemeter_create(lv_scr_act(), nullptr); lv_linemeter_set_scale(major_scales, 300, 11); @@ -79,7 +80,7 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, lv_obj_set_style_local_bg_opa(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 6); lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4); - lv_obj_set_style_local_scale_end_color(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_scale_end_color(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, White); large_scales = lv_linemeter_create(lv_scr_act(), nullptr); lv_linemeter_set_scale(large_scales, 180, 3); @@ -89,13 +90,13 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, lv_obj_set_style_local_bg_opa(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_scale_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 20); lv_obj_set_style_local_scale_end_line_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4); - lv_obj_set_style_local_scale_end_color(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); + lv_obj_set_style_local_scale_end_color(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, Aqua); twelve = lv_label_create(lv_scr_act(), nullptr); lv_label_set_align(twelve, LV_LABEL_ALIGN_CENTER); lv_label_set_text_static(twelve, "12"); lv_obj_set_pos(twelve, 110, 10); - lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); + lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Aqua); batteryIcon.Create(lv_scr_act()); lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); @@ -109,14 +110,14 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, lv_obj_align(bleIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -30, 0); 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_LIME); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Lime); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0); // Date - Day / Week day label_date_day = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange); + lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, 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, nullptr, LV_ALIGN_CENTER, 50, 0); @@ -129,31 +130,31 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, lv_style_init(&second_line_style); lv_style_set_line_width(&second_line_style, LV_STATE_DEFAULT, 3); - lv_style_set_line_color(&second_line_style, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_style_set_line_color(&second_line_style, LV_STATE_DEFAULT, Red); lv_style_set_line_rounded(&second_line_style, LV_STATE_DEFAULT, true); lv_obj_add_style(second_body, LV_LINE_PART_MAIN, &second_line_style); lv_style_init(&minute_line_style); lv_style_set_line_width(&minute_line_style, LV_STATE_DEFAULT, 7); - lv_style_set_line_color(&minute_line_style, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_line_color(&minute_line_style, LV_STATE_DEFAULT, White); lv_style_set_line_rounded(&minute_line_style, LV_STATE_DEFAULT, true); lv_obj_add_style(minute_body, LV_LINE_PART_MAIN, &minute_line_style); lv_style_init(&minute_line_style_trace); lv_style_set_line_width(&minute_line_style_trace, LV_STATE_DEFAULT, 3); - lv_style_set_line_color(&minute_line_style_trace, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_line_color(&minute_line_style_trace, LV_STATE_DEFAULT, White); lv_style_set_line_rounded(&minute_line_style_trace, LV_STATE_DEFAULT, false); lv_obj_add_style(minute_body_trace, LV_LINE_PART_MAIN, &minute_line_style_trace); lv_style_init(&hour_line_style); lv_style_set_line_width(&hour_line_style, LV_STATE_DEFAULT, 7); - lv_style_set_line_color(&hour_line_style, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_line_color(&hour_line_style, LV_STATE_DEFAULT, White); lv_style_set_line_rounded(&hour_line_style, LV_STATE_DEFAULT, true); lv_obj_add_style(hour_body, LV_LINE_PART_MAIN, &hour_line_style); lv_style_init(&hour_line_style_trace); lv_style_set_line_width(&hour_line_style_trace, LV_STATE_DEFAULT, 3); - lv_style_set_line_color(&hour_line_style_trace, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_line_color(&hour_line_style_trace, LV_STATE_DEFAULT, White); lv_style_set_line_rounded(&hour_line_style_trace, LV_STATE_DEFAULT, false); lv_obj_add_style(hour_body_trace, LV_LINE_PART_MAIN, &hour_line_style_trace); diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp index c695f852fe..36feb54456 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp @@ -296,7 +296,7 @@ void WatchFaceCasioStyleG7710::Refresh() { lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color_text); lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get()); } else { - lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B)); + lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Color(0x1B1B1B)); lv_label_set_text_static(heartbeatValue, ""); } diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.h b/src/displayapp/screens/WatchFaceCasioStyleG7710.h index 0f46a69251..99481bb8f1 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.h +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.h @@ -11,6 +11,7 @@ #include "components/ble/BleController.h" #include "utility/DirtyValue.h" #include "displayapp/apps/Apps.h" +#include "displayapp/Colors.h" namespace Pinetime { namespace Controllers { @@ -59,7 +60,7 @@ namespace Pinetime { lv_point_t line_date_points[3] {{0, 5}, {135, 5}, {140, 0}}; lv_point_t line_time_points[3] {{0, 0}, {230, 0}, {235, 5}}; - lv_color_t color_text = lv_color_hex(0x98B69A); + Colors::Color color_text = 0x98B69A; lv_style_t style_line; lv_style_t style_border; diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 3163c6e750..70754f3659 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -37,25 +37,25 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, 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_LIME); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Lime); lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0); weatherIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(weatherIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_obj_set_style_local_text_color(weatherIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Color(0x999999)); lv_obj_set_style_local_text_font(weatherIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &fontawesome_weathericons); lv_label_set_text(weatherIcon, ""); lv_obj_align(weatherIcon, nullptr, LV_ALIGN_IN_TOP_MID, -20, 50); lv_obj_set_auto_realign(weatherIcon, true); temperature = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(temperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_obj_set_style_local_text_color(temperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Color(0x999999)); lv_label_set_text(temperature, ""); lv_obj_align(temperature, nullptr, LV_ALIGN_IN_TOP_MID, 20, 50); label_date = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_CENTER, 0, 60); - lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); + lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Color(0x999999)); label_time = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed); @@ -68,21 +68,21 @@ WatchFaceDigital::WatchFaceDigital(Controllers::DateTime& dateTimeController, heartbeatIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(heartbeatIcon, Symbols::heartBeat); - lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B)); + lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Color(0xCE1B1B)); lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); heartbeatValue = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B)); + lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Color(0xCE1B1B)); lv_label_set_text_static(heartbeatValue, ""); lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); stepValue = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FFE7)); + lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Color(0x00FFE7)); lv_label_set_text_static(stepValue, "0"); lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); stepIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FFE7)); + lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Color(0x00FFE7)); lv_label_set_text_static(stepIcon, Symbols::shoe); lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); @@ -154,10 +154,10 @@ void WatchFaceDigital::Refresh() { heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { if (heartbeatRunning.Get()) { - lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B)); + lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Color(0xCE1B1B)); lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get()); } else { - lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x1B1B1B)); + lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Color(0x1B1B1B)); lv_label_set_text_static(heartbeatValue, ""); } diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp index c793971103..a7938b7eac 100644 --- a/src/displayapp/screens/WatchFaceInfineat.cpp +++ b/src/displayapp/screens/WatchFaceInfineat.cpp @@ -32,71 +32,22 @@ namespace { constexpr int nLines = WatchFaceInfineat::nLines; - constexpr std::array orangeColors = {LV_COLOR_MAKE(0xfd, 0x87, 0x2b), - LV_COLOR_MAKE(0xdb, 0x33, 0x16), - LV_COLOR_MAKE(0x6f, 0x10, 0x00), - LV_COLOR_MAKE(0xfd, 0x7a, 0x0a), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xe8, 0x51, 0x02), - LV_COLOR_MAKE(0xea, 0x1c, 0x00)}; - constexpr std::array blueColors = {LV_COLOR_MAKE(0xe7, 0xf8, 0xff), - LV_COLOR_MAKE(0x22, 0x32, 0xd0), - LV_COLOR_MAKE(0x18, 0x2a, 0x8b), - LV_COLOR_MAKE(0xe7, 0xf8, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0x59, 0x91, 0xff), - LV_COLOR_MAKE(0x16, 0x36, 0xff)}; - constexpr std::array greenColors = {LV_COLOR_MAKE(0xb8, 0xff, 0x9b), - LV_COLOR_MAKE(0x08, 0x86, 0x08), - LV_COLOR_MAKE(0x00, 0x4a, 0x00), - LV_COLOR_MAKE(0xb8, 0xff, 0x9b), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0x62, 0xd5, 0x15), - LV_COLOR_MAKE(0x00, 0x74, 0x00)}; - constexpr std::array rainbowColors = {LV_COLOR_MAKE(0x2d, 0xa4, 0x00), - LV_COLOR_MAKE(0xac, 0x09, 0xc4), - LV_COLOR_MAKE(0xfe, 0x03, 0x03), - LV_COLOR_MAKE(0x0d, 0x57, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xe0, 0xb9, 0x00), - LV_COLOR_MAKE(0xe8, 0x51, 0x02)}; - constexpr std::array grayColors = {LV_COLOR_MAKE(0xee, 0xee, 0xee), - LV_COLOR_MAKE(0x98, 0x95, 0x9b), - LV_COLOR_MAKE(0x19, 0x19, 0x19), - LV_COLOR_MAKE(0xee, 0xee, 0xee), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0x91, 0x91, 0x91), - LV_COLOR_MAKE(0x3a, 0x3a, 0x3a)}; - constexpr std::array nordBlueColors = {LV_COLOR_MAKE(0xc3, 0xda, 0xf2), - LV_COLOR_MAKE(0x4d, 0x78, 0xce), - LV_COLOR_MAKE(0x15, 0x34, 0x51), - LV_COLOR_MAKE(0xc3, 0xda, 0xf2), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0x5d, 0x8a, 0xd2), - LV_COLOR_MAKE(0x21, 0x51, 0x8a)}; - constexpr std::array nordGreenColors = {LV_COLOR_MAKE(0xd5, 0xf0, 0xe9), - LV_COLOR_MAKE(0x23, 0x83, 0x73), - LV_COLOR_MAKE(0x1d, 0x41, 0x3f), - LV_COLOR_MAKE(0xd5, 0xf0, 0xe9), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0xff, 0xff, 0xff), - LV_COLOR_MAKE(0x2f, 0xb8, 0xa2), - LV_COLOR_MAKE(0x11, 0x70, 0x5a)}; - - constexpr const std::array* returnColor(colors color) { + constexpr std::array orangeColors = + {0xfd872b, 0xdb3316, 0x6f1000, 0xfd7a0a, 0xffffff, 0xffffff, 0xffffff, 0xe85102, 0xea1c00}; + constexpr std::array blueColors = + {0xe7f8ff, 0x2232d0, 0x182a8b, 0xe7f8ff, 0xffffff, 0xffffff, 0xffffff, 0x5991ff, 0x1636ff}; + constexpr std::array greenColors = + {0xb8ff9b, 0x088608, 0x004a00, 0xb8ff9b, 0xffffff, 0xffffff, 0xffffff, 0x62d515, 0x007400}; + constexpr std::array rainbowColors = + {0x2da400, 0xac09c4, 0xfe0303, 0x0d57ff, 0xffffff, 0xffffff, 0xffffff, 0xe0b900, 0xe85102}; + constexpr std::array grayColors = + {0xeeeeee, 0x98959b, 0x191919, 0xeeeeee, 0xffffff, 0xffffff, 0xffffff, 0x919191, 0x3a3a3a}; + constexpr std::array nordBlueColors = + {0xc3daf2, 0x4d78ce, 0x153451, 0xc3daf2, 0xffffff, 0xffffff, 0xffffff, 0x5d8ad2, 0x21518a}; + constexpr std::array nordGreenColors = + {0xd5f0e9, 0x238373, 0x1d413f, 0xd5f0e9, 0xffffff, 0xffffff, 0xffffff, 0x2fb8a2, 0x11705a}; + + constexpr const std::array* returnColor(colors color) { if (color == colors::orange) { return &orangeColors; } @@ -157,11 +108,11 @@ WatchFaceInfineat::WatchFaceInfineat(Controllers::DateTime& dateTimeController, static constexpr lv_style_int_t lineWidths[nLines] = {18, 15, 14, 22, 20, 18, 18, 52, 48}; - const std::array* colors = returnColor(static_cast(settingsController.GetInfineatColorIndex())); + const std::array* colors = returnColor(static_cast(settingsController.GetInfineatColorIndex())); for (int i = 0; i < nLines; i++) { lines[i] = lv_line_create(lv_scr_act(), nullptr); lv_obj_set_style_local_line_width(lines[i], LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lineWidths[i]); - lv_color_t color = (*colors)[i]; + Colors::Color color = (*colors)[i]; lv_obj_set_style_local_line_color(lines[i], LV_LINE_PART_MAIN, LV_STATE_DEFAULT, color); lv_line_set_points(lines[i], linePoints[i], 2); } @@ -218,7 +169,7 @@ WatchFaceInfineat::WatchFaceInfineat(Controllers::DateTime& dateTimeController, lv_obj_set_size(dateContainer, 60, 30); lv_obj_align(dateContainer, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 5); - static constexpr lv_color_t grayColor = LV_COLOR_MAKE(0x99, 0x99, 0x99); + static constexpr Colors::Color grayColor = 0x999999; labelDate = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(labelDate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, grayColor); lv_obj_set_style_local_text_font(labelDate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko); @@ -379,9 +330,9 @@ void WatchFaceInfineat::UpdateSelected(lv_obj_t* object, lv_event_t event) { settingsController.SetInfineatColorIndex(colorIndex); } if (object == btnNextColor || object == btnPrevColor) { - const std::array* colors = returnColor(static_cast(settingsController.GetInfineatColorIndex())); + const std::array* colors = returnColor(static_cast(settingsController.GetInfineatColorIndex())); for (int i = 0; i < nLines; i++) { - lv_color_t color = (*colors)[i]; + Colors::Color color = (*colors)[i]; lv_obj_set_style_local_line_color(lines[i], LV_LINE_PART_MAIN, LV_STATE_DEFAULT, color); } lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, (*colors)[4]); @@ -479,12 +430,12 @@ void WatchFaceInfineat::SetBatteryLevel(uint8_t batteryPercent) { void WatchFaceInfineat::ToggleBatteryIndicatorColor(bool showSideCover) { if (!showSideCover) { // make indicator and notification icon color white lv_obj_set_style_local_image_recolor_opa(logoPine, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100); - lv_obj_set_style_local_image_recolor(logoPine, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_bg_color(notificationIcon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_image_recolor(logoPine, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, Colors::White); + lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::Black); + lv_obj_set_style_local_bg_color(notificationIcon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::White); } else { lv_obj_set_style_local_image_recolor_opa(logoPine, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0); - const std::array* colors = returnColor(static_cast(settingsController.GetInfineatColorIndex())); + const std::array* colors = returnColor(static_cast(settingsController.GetInfineatColorIndex())); lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, (*colors)[4]); lv_obj_set_style_local_bg_color(notificationIcon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, (*colors)[7]); } diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index ce8f8f7ed9..8fcafb971a 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -22,6 +22,9 @@ #include "displayapp/screens/WatchFacePineTimeStyle.h" #include #include +#include +#include +#include #include "displayapp/Colors.h" #include "displayapp/screens/BatteryIcon.h" #include "displayapp/screens/BleIcon.h" @@ -37,6 +40,26 @@ #include "components/ble/SimpleWeatherService.h" using namespace Pinetime::Applications::Screens; +using namespace Colors; + +constexpr std::array StyleColors {White, + Silver, + Gray, + Black, + Red, + Maroon, + Yellow, + Olive, + Lime, + Green, + Cyan, + Teal, + Blue, + Navy, + Magenta, + Purple, + Orange, + Pink}; namespace { void event_handler(lv_obj_t* obj, lv_event_t event) { @@ -53,6 +76,7 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(Controllers::DateTime& dateTimeCo Controllers::MotionController& motionController, Controllers::SimpleWeatherService& weatherService) : currentDateTime {{}}, + needle_colors {White}, batteryIcon(false), dateTimeController {dateTimeController}, batteryController {batteryController}, @@ -64,7 +88,7 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(Controllers::DateTime& dateTimeCo // Create a 200px wide background rectangle timebar = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBG())); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, settingsController.GetPTSColorBG()); lv_obj_set_style_local_radius(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); lv_obj_set_size(timebar, 200, 240); lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0); @@ -72,49 +96,49 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(Controllers::DateTime& dateTimeCo // Display the time timeDD1 = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, settingsController.GetPTSColorTime()); lv_label_set_text_static(timeDD1, "00"); lv_obj_align(timeDD1, timebar, LV_ALIGN_IN_TOP_MID, 5, 5); timeDD2 = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, settingsController.GetPTSColorTime()); lv_label_set_text_static(timeDD2, "00"); lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5); timeAMPM = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, settingsController.GetPTSColorTime()); lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3); lv_label_set_text_static(timeAMPM, ""); lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20); // Create a 40px wide bar down the right side of the screen sidebar = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBar())); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, settingsController.GetPTSColorBar()); lv_obj_set_style_local_radius(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); lv_obj_set_size(sidebar, 40, 240); lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); // Display icons batteryIcon.Create(sidebar); - batteryIcon.SetColor(LV_COLOR_BLACK); + batteryIcon.SetColor(Black); lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_MID, 10, 2); plugIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(plugIcon, Symbols::plug); - lv_obj_set_style_local_text_color(plugIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_text_color(plugIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Black); lv_obj_align(plugIcon, sidebar, LV_ALIGN_IN_TOP_MID, 10, 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_BLACK); + lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Black); lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, -10, 2); notificationIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime())); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, settingsController.GetPTSColorTime()); lv_obj_align(notificationIcon, timebar, LV_ALIGN_IN_TOP_LEFT, 5, 5); weatherIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(weatherIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_text_color(weatherIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Black); lv_obj_set_style_local_text_font(weatherIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &fontawesome_weathericons); lv_label_set_text(weatherIcon, Symbols::ban); lv_obj_align(weatherIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 35); @@ -126,7 +150,7 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(Controllers::DateTime& dateTimeCo } temperature = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(temperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_text_color(temperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Black); lv_label_set_text(temperature, "--"); lv_obj_align(temperature, sidebar, LV_ALIGN_IN_TOP_MID, 0, 65); if (settingsController.GetPTSWeather() == Pinetime::Controllers::Settings::PTSWeather::On) { @@ -137,7 +161,7 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(Controllers::DateTime& dateTimeCo // Calendar icon calendarOuter = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::Black); lv_obj_set_style_local_radius(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); lv_obj_set_size(calendarOuter, 34, 34); if (settingsController.GetPTSWeather() == Pinetime::Controllers::Settings::PTSWeather::On) { @@ -147,59 +171,60 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(Controllers::DateTime& dateTimeCo } calendarInner = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarInner, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_bg_color(calendarInner, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, White); lv_obj_set_style_local_radius(calendarInner, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); lv_obj_set_size(calendarInner, 27, 27); lv_obj_align(calendarInner, calendarOuter, LV_ALIGN_CENTER, 0, 0); calendarBar1 = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(calendarBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Black); lv_obj_set_style_local_radius(calendarBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); lv_obj_set_size(calendarBar1, 3, 12); lv_obj_align(calendarBar1, calendarOuter, LV_ALIGN_IN_TOP_MID, -6, -3); calendarBar2 = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(calendarBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Black); lv_obj_set_style_local_radius(calendarBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); lv_obj_set_size(calendarBar2, 3, 12); lv_obj_align(calendarBar2, calendarOuter, LV_ALIGN_IN_TOP_MID, 6, -3); calendarCrossBar1 = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarCrossBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(calendarCrossBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Black); lv_obj_set_style_local_radius(calendarCrossBar1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); lv_obj_set_size(calendarCrossBar1, 8, 3); lv_obj_align(calendarCrossBar1, calendarBar1, LV_ALIGN_IN_BOTTOM_MID, 0, 0); calendarCrossBar2 = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(calendarCrossBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(calendarCrossBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Black); lv_obj_set_style_local_radius(calendarCrossBar2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); lv_obj_set_size(calendarCrossBar2, 8, 3); lv_obj_align(calendarCrossBar2, calendarBar2, LV_ALIGN_IN_BOTTOM_MID, 0, 0); // Display date dateDayOfWeek = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(dateDayOfWeek, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_text_color(dateDayOfWeek, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Black); lv_label_set_text_static(dateDayOfWeek, "THU"); lv_obj_align(dateDayOfWeek, calendarOuter, LV_ALIGN_CENTER, 0, -32); dateDay = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_text_color(dateDay, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Black); lv_label_set_text_static(dateDay, "25"); lv_obj_align(dateDay, calendarOuter, LV_ALIGN_CENTER, 0, 3); dateMonth = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(dateMonth, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_text_color(dateMonth, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Black); lv_label_set_text_static(dateMonth, "MAR"); lv_obj_align(dateMonth, calendarOuter, LV_ALIGN_CENTER, 0, 32); // Step count gauge - if (settingsController.GetPTSColorBar() == Pinetime::Controllers::Settings::Colors::White) { - needle_colors[0] = LV_COLOR_BLACK; + if (settingsController.GetPTSColorBar() == White) { + needle_colors = Black; } else { - needle_colors[0] = LV_COLOR_WHITE; + needle_colors = White; } stepGauge = lv_gauge_create(lv_scr_act(), nullptr); - lv_gauge_set_needle_count(stepGauge, 1, needle_colors); + lv_color_t needle_color_arg[1] = {needle_colors}; + lv_gauge_set_needle_count(stepGauge, 1, needle_color_arg); lv_gauge_set_range(stepGauge, 0, 100); lv_gauge_set_value(stepGauge, 0, 0); if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Full) { @@ -224,13 +249,13 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(Controllers::DateTime& dateTimeCo lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER); lv_obj_set_style_local_scale_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4); lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4); - lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, Black); lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, LV_OPA_COVER); lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4); stepValue = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Black); lv_label_set_text_static(stepValue, "0"); lv_obj_align(stepValue, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Numeric) { @@ -240,7 +265,7 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(Controllers::DateTime& dateTimeCo } stepIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Black); lv_label_set_text_static(stepIcon, Symbols::shoe); lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_TOP_MID, 0, 0); if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Numeric) { @@ -251,7 +276,7 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(Controllers::DateTime& dateTimeCo // Display seconds timeDD3 = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(timeDD3, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_text_color(timeDD3, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Black); lv_label_set_text_static(timeDD3, ":00"); lv_obj_align(timeDD3, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Half) { @@ -534,8 +559,8 @@ void WatchFacePineTimeStyle::Refresh() { lv_label_set_text_fmt(stepValue, "%luK", (stepCount.Get() / 1000)); lv_obj_realign(stepValue); if (stepCount.Get() > settingsController.GetStepsGoal()) { - lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_obj_set_style_local_scale_grad_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, White); + lv_obj_set_style_local_scale_grad_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, White); } } @@ -578,9 +603,9 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) valueTime = GetNext(valueTime); } settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, valueTime); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, valueTime); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, valueTime); } if (object == btnPrevTime) { valueTime = GetPrevious(valueTime); @@ -588,35 +613,35 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) valueTime = GetPrevious(valueTime); } settingsController.SetPTSColorTime(valueTime); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, valueTime); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, valueTime); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, valueTime); } if (object == btnNextBar) { valueBar = GetNext(valueBar); - if (valueBar == Controllers::Settings::Colors::Black) { + if (valueBar == Black) { valueBar = GetNext(valueBar); } - if (valueBar == Controllers::Settings::Colors::White) { - needle_colors[0] = LV_COLOR_BLACK; + if (valueBar == White) { + needle_colors = Black; } else { - needle_colors[0] = LV_COLOR_WHITE; + needle_colors = White; } settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, valueBar); } if (object == btnPrevBar) { valueBar = GetPrevious(valueBar); - if (valueBar == Controllers::Settings::Colors::Black) { + if (valueBar == Black) { valueBar = GetPrevious(valueBar); } - if (valueBar == Controllers::Settings::Colors::White) { - needle_colors[0] = LV_COLOR_BLACK; + if (valueBar == White) { + needle_colors = Black; } else { - needle_colors[0] = LV_COLOR_WHITE; + needle_colors = White; } settingsController.SetPTSColorBar(valueBar); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, valueBar); } if (object == btnNextBG) { valueBG = GetNext(valueBG); @@ -624,7 +649,7 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) valueBG = GetNext(valueBG); } settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, valueBG); } if (object == btnPrevBG) { valueBG = GetPrevious(valueBG); @@ -632,42 +657,44 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) valueBG = GetPrevious(valueBG); } settingsController.SetPTSColorBG(valueBG); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, valueBG); } if (object == btnReset) { - needle_colors[0] = LV_COLOR_WHITE; - settingsController.SetPTSColorTime(Controllers::Settings::Colors::Teal); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); - settingsController.SetPTSColorBar(Controllers::Settings::Colors::Teal); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal)); - settingsController.SetPTSColorBG(Controllers::Settings::Colors::Black); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Black)); + needle_colors = White; + settingsController.SetPTSColorTime(Teal); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Teal); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Teal); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Teal); + settingsController.SetPTSColorBar(Teal); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Teal); + settingsController.SetPTSColorBG(Black); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Black); } if (object == btnRandom) { - valueTime = static_cast(rand() % 17); - valueBar = static_cast(rand() % 17); - valueBG = static_cast(rand() % 17); + static std::mt19937 g(std::random_device {}()); + std::uniform_int_distribution distrib(0, StyleColors.size() - 1); + valueTime = StyleColors[distrib(g)]; + valueBar = StyleColors[distrib(g)]; + valueBG = StyleColors[distrib(g)]; if (valueTime == valueBG) { valueBG = GetNext(valueBG); } - if (valueBar == Controllers::Settings::Colors::Black) { + if (valueBar == Black) { valueBar = GetPrevious(valueBar); } - if (valueBar == Controllers::Settings::Colors::White) { - needle_colors[0] = LV_COLOR_BLACK; + if (valueBar == White) { + needle_colors = Black; } else { - needle_colors[0] = LV_COLOR_WHITE; + needle_colors = White; } - settingsController.SetPTSColorTime(static_cast(valueTime)); - lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime)); - settingsController.SetPTSColorBar(static_cast(valueBar)); - lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar)); - settingsController.SetPTSColorBG(static_cast(valueBG)); - lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG)); + settingsController.SetPTSColorTime(valueTime); + lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, valueTime); + lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, valueTime); + lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, valueTime); + settingsController.SetPTSColorBar(valueBar); + lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, valueBar); + settingsController.SetPTSColorBG(valueBG); + lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, valueBG); } if (object == btnClose) { CloseMenu(); @@ -756,25 +783,20 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) } } -Pinetime::Controllers::Settings::Colors WatchFacePineTimeStyle::GetNext(Pinetime::Controllers::Settings::Colors color) { - auto colorAsInt = static_cast(color); - Pinetime::Controllers::Settings::Colors nextColor; - if (colorAsInt < 17) { - nextColor = static_cast(colorAsInt + 1); +Color WatchFacePineTimeStyle::GetNext(Color color) { + auto itNextColor = std::next(std::find(StyleColors.begin(), StyleColors.end(), color)); + if (itNextColor != std::end(StyleColors)) { + return *itNextColor; } else { - nextColor = static_cast(0); + return *std::begin(StyleColors); } - return nextColor; } -Pinetime::Controllers::Settings::Colors WatchFacePineTimeStyle::GetPrevious(Pinetime::Controllers::Settings::Colors color) { - auto colorAsInt = static_cast(color); - Pinetime::Controllers::Settings::Colors prevColor; - - if (colorAsInt > 0) { - prevColor = static_cast(colorAsInt - 1); +Color WatchFacePineTimeStyle::GetPrevious(Color color) { + auto itPreviousColor = std::next(std::find(StyleColors.rbegin(), StyleColors.rend(), color)); + if (itPreviousColor != std::rend(StyleColors)) { + return *itPreviousColor; } else { - prevColor = static_cast(17); + return *std::rbegin(StyleColors); } - return prevColor; } diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.h b/src/displayapp/screens/WatchFacePineTimeStyle.h index e44a612891..b7ce22e80f 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.h +++ b/src/displayapp/screens/WatchFacePineTimeStyle.h @@ -63,8 +63,8 @@ namespace Pinetime { Utility::DirtyValue notificationState {}; Utility::DirtyValue> currentWeather {}; - static Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color); - static Pinetime::Controllers::Settings::Colors GetPrevious(Controllers::Settings::Colors color); + static Colors::Color GetNext(Colors::Color color); + static Colors::Color GetPrevious(Colors::Color color); lv_obj_t* btnNextTime; lv_obj_t* btnPrevTime; @@ -102,7 +102,7 @@ namespace Pinetime { lv_obj_t* btnSetOpts; lv_obj_t* stepIcon; lv_obj_t* stepValue; - lv_color_t needle_colors[1]; + Colors::Color needle_colors; BatteryIcon batteryIcon; diff --git a/src/displayapp/screens/WatchFacePrideFlag.cpp b/src/displayapp/screens/WatchFacePrideFlag.cpp index e029c076f4..b1eceb3b60 100644 --- a/src/displayapp/screens/WatchFacePrideFlag.cpp +++ b/src/displayapp/screens/WatchFacePrideFlag.cpp @@ -37,10 +37,10 @@ namespace { template class PrideFlagData { public: - constexpr PrideFlagData(const std::array& sectionColours, - lv_color_t defaultTopLabelColour, - lv_color_t labelTimeColour, - lv_color_t defaultBottomLabelColour) + constexpr PrideFlagData(const std::array& sectionColours, + Colors::Color defaultTopLabelColour, + Colors::Color labelTimeColour, + Colors::Color defaultBottomLabelColour) : sectionColours {sectionColours}, defaultTopLabelColour {defaultTopLabelColour}, labelTimeColour {labelTimeColour}, @@ -49,36 +49,36 @@ namespace { spacing = static_cast(1.5f * static_cast(N) + 40.5f); } - std::array sectionColours; - lv_color_t defaultTopLabelColour; - lv_color_t labelTimeColour; - lv_color_t defaultBottomLabelColour; + std::array sectionColours; + Colors::Color defaultTopLabelColour; + Colors::Color labelTimeColour; + Colors::Color defaultBottomLabelColour; uint8_t spacing; }; - constexpr lv_color_t lightBlue = LV_COLOR_MAKE(0x00, 0xbf, 0xf3); - constexpr lv_color_t lightPink = LV_COLOR_MAKE(0xf4, 0x9a, 0xc1); - constexpr lv_color_t hotPink = LV_COLOR_MAKE(0xd6, 0x02, 0x70); - constexpr lv_color_t grayPurple = LV_COLOR_MAKE(0x9b, 0x4f, 0x96); - constexpr lv_color_t darkBlue = LV_COLOR_MAKE(0x00, 0x38, 0xa8); - constexpr lv_color_t orange = LV_COLOR_MAKE(0xef, 0x76, 0x27); - constexpr lv_color_t lightOrange = LV_COLOR_MAKE(0xff, 0x9b, 0x55); - constexpr lv_color_t lightPurple = LV_COLOR_MAKE(0xd4, 0x61, 0xa6); - constexpr lv_color_t darkPurple = LV_COLOR_MAKE(0xb5, 0x56, 0x90); - constexpr lv_color_t magenta = LV_COLOR_MAKE(0xa5, 0x00, 0x62); - constexpr lv_color_t darkGreen = LV_COLOR_MAKE(0x07, 0x8d, 0x70); - constexpr lv_color_t cyan = LV_COLOR_MAKE(0x26, 0xce, 0xaa); - constexpr lv_color_t lightGreen = LV_COLOR_MAKE(0x98, 0xe8, 0xc1); - constexpr lv_color_t indigo = LV_COLOR_MAKE(0x50, 0x49, 0xcc); - constexpr lv_color_t steelBlue = LV_COLOR_MAKE(0x3d, 0x1a, 0x78); - constexpr std::array gayColours {darkGreen, cyan, lightGreen, LV_COLOR_WHITE, lightBlue, indigo, steelBlue}; - constexpr std::array transColours {lightBlue, lightPink, LV_COLOR_WHITE, lightPink, lightBlue}; - constexpr std::array biColours {hotPink, hotPink, grayPurple, darkBlue, darkBlue}; - constexpr std::array lesbianColours {LV_COLOR_RED, orange, lightOrange, LV_COLOR_WHITE, lightPurple, darkPurple, magenta}; - constexpr PrideFlagData gayFlagData(gayColours, LV_COLOR_BLACK, LV_COLOR_BLACK, LV_COLOR_WHITE); - constexpr PrideFlagData transFlagData(transColours, LV_COLOR_WHITE, LV_COLOR_BLACK, LV_COLOR_WHITE); - constexpr PrideFlagData biFlagData(biColours, LV_COLOR_BLACK, LV_COLOR_WHITE, LV_COLOR_BLACK); - constexpr PrideFlagData lesbianFlagData(lesbianColours, LV_COLOR_WHITE, LV_COLOR_BLACK, LV_COLOR_WHITE); + constexpr Colors::Color lightBlue = 0x00bff3; + constexpr Colors::Color lightPink = 0xf49ac1; + constexpr Colors::Color hotPink = 0xd60270; + constexpr Colors::Color grayPurple = 0x9b4f96; + constexpr Colors::Color darkBlue = 0x0038a8; + constexpr Colors::Color orange = 0xef7627; + constexpr Colors::Color lightOrange = 0xff9b55; + constexpr Colors::Color lightPurple = 0xd461a6; + constexpr Colors::Color darkPurple = 0xb55690; + constexpr Colors::Color magenta = 0xa50062; + constexpr Colors::Color darkGreen = 0x078d70; + constexpr Colors::Color cyan = 0x26ceaa; + constexpr Colors::Color lightGreen = 0x98e8c1; + constexpr Colors::Color indigo = 0x5049cc; + constexpr Colors::Color steelBlue = 0x3d1a78; + constexpr std::array gayColours {darkGreen, cyan, lightGreen, Colors::White, lightBlue, indigo, steelBlue}; + constexpr std::array transColours {lightBlue, lightPink, Colors::White, lightPink, lightBlue}; + constexpr std::array biColours {hotPink, hotPink, grayPurple, darkBlue, darkBlue}; + constexpr std::array lesbianColours {Colors::Red, orange, lightOrange, Colors::White, lightPurple, darkPurple, magenta}; + constexpr PrideFlagData gayFlagData(gayColours, Colors::Black, Colors::Black, Colors::White); + constexpr PrideFlagData transFlagData(transColours, Colors::White, Colors::Black, Colors::White); + constexpr PrideFlagData biFlagData(biColours, Colors::Black, Colors::White, Colors::Black); + constexpr PrideFlagData lesbianFlagData(lesbianColours, Colors::White, Colors::Black, Colors::White); } WatchFacePrideFlag::WatchFacePrideFlag(Controllers::DateTime& dateTimeController, @@ -106,7 +106,7 @@ WatchFacePrideFlag::WatchFacePrideFlag(Controllers::DateTime& dateTimeController notificationText = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(notificationText, nullptr, LV_ALIGN_IN_LEFT_MID, 0, -110); - lv_obj_set_style_local_text_color(notificationText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_text_color(notificationText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Black); btnClose = lv_btn_create(lv_scr_act(), nullptr); btnClose->user_data = this; diff --git a/src/displayapp/screens/Weather.cpp b/src/displayapp/screens/Weather.cpp index 25464c70cf..ba1081b712 100644 --- a/src/displayapp/screens/Weather.cpp +++ b/src/displayapp/screens/Weather.cpp @@ -12,15 +12,15 @@ using namespace Pinetime::Applications::Screens; namespace { - lv_color_t TemperatureColor(Pinetime::Controllers::SimpleWeatherService::Temperature temp) { + Colors::Color TemperatureColor(Pinetime::Controllers::SimpleWeatherService::Temperature temp) { if (temp.Celsius() <= 0) { // freezing - return Colors::blue; + return Colors::Blue; } else if (temp.Celsius() <= 4) { // ice - return LV_COLOR_CYAN; + return Colors::Cyan; } else if (temp.Celsius() >= 27) { // hot - return Colors::deepOrange; + return Colors::DeepOrange; } - return Colors::orange; // normal + return Colors::Orange; // normal } uint8_t TemperatureStyle(Pinetime::Controllers::SimpleWeatherService::Temperature temp) { @@ -37,34 +37,35 @@ namespace { Weather::Weather(Controllers::Settings& settingsController, Controllers::SimpleWeatherService& weatherService) : settingsController {settingsController}, weatherService {weatherService} { + using namespace Colors; temperature = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(temperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_text_color(temperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, White); lv_obj_set_style_local_text_font(temperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); lv_label_set_text(temperature, "---"); lv_obj_align(temperature, nullptr, LV_ALIGN_CENTER, 0, -30); lv_obj_set_auto_realign(temperature, true); minTemperature = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(minTemperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::bg); + lv_obj_set_style_local_text_color(minTemperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bg); lv_label_set_text(minTemperature, ""); lv_obj_align(minTemperature, temperature, LV_ALIGN_OUT_LEFT_MID, -10, 0); lv_obj_set_auto_realign(minTemperature, true); maxTemperature = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(maxTemperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::bg); + lv_obj_set_style_local_text_color(maxTemperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bg); lv_label_set_text(maxTemperature, ""); lv_obj_align(maxTemperature, temperature, LV_ALIGN_OUT_RIGHT_MID, 10, 0); lv_obj_set_auto_realign(maxTemperature, true); condition = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(condition, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); + lv_obj_set_style_local_text_color(condition, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LightGray); lv_label_set_text(condition, ""); lv_obj_align(condition, temperature, LV_ALIGN_OUT_TOP_MID, 0, -10); lv_obj_set_auto_realign(condition, true); icon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, White); lv_obj_set_style_local_text_font(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &fontawesome_weathericons); lv_label_set_text(icon, ""); lv_obj_align(icon, condition, LV_ALIGN_OUT_TOP_MID, 0, 0); @@ -74,24 +75,24 @@ Weather::Weather(Controllers::Settings& settingsController, Controllers::SimpleW lv_table_set_col_cnt(forecast, Controllers::SimpleWeatherService::MaxNbForecastDays); lv_table_set_row_cnt(forecast, 4); // LV_TABLE_PART_CELL1: Default table style - lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, Colors::lightGray); + lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, Black); + lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, LightGray); // LV_TABLE_PART_CELL2: Condition icon - lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL2, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL2, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL2, LV_STATE_DEFAULT, Black); + lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL2, LV_STATE_DEFAULT, White); lv_obj_set_style_local_text_font(forecast, LV_TABLE_PART_CELL2, LV_STATE_DEFAULT, &fontawesome_weathericons); // LV_TABLE_PART_CELL3: Freezing - lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL3, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL3, LV_STATE_DEFAULT, Colors::blue); + lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL3, LV_STATE_DEFAULT, Black); + lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL3, LV_STATE_DEFAULT, Blue); // LV_TABLE_PART_CELL4: Ice - lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL4, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL4, LV_STATE_DEFAULT, LV_COLOR_CYAN); + lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL4, LV_STATE_DEFAULT, Black); + lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL4, LV_STATE_DEFAULT, Cyan); // LV_TABLE_PART_CELL5: Normal - lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL5, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL5, LV_STATE_DEFAULT, Colors::orange); + lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL5, LV_STATE_DEFAULT, Black); + lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL5, LV_STATE_DEFAULT, Orange); // LV_TABLE_PART_CELL6: Hot - lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL6, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL6, LV_STATE_DEFAULT, Colors::deepOrange); + lv_obj_set_style_local_border_color(forecast, LV_TABLE_PART_CELL6, LV_STATE_DEFAULT, Black); + lv_obj_set_style_local_text_color(forecast, LV_TABLE_PART_CELL6, LV_STATE_DEFAULT, DeepOrange); lv_obj_align(forecast, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); @@ -141,7 +142,7 @@ void Weather::Refresh() { lv_label_set_text(icon, ""); lv_label_set_text(condition, ""); lv_label_set_text(temperature, "---"); - lv_obj_set_style_local_text_color(temperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_text_color(temperature, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::White); lv_label_set_text(minTemperature, ""); lv_label_set_text(maxTemperature, ""); } diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index c5c3071aef..5ab721b761 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -60,7 +60,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, 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, Colors::bgAlt); + lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); btn1 = lv_btn_create(lv_scr_act(), nullptr); btn1->user_data = this; @@ -89,9 +89,14 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, btn3->user_data = this; lv_obj_set_event_cb(btn3, ButtonEventHandler); lv_obj_add_style(btn3, LV_BTN_PART_MAIN, &btn_style); - lv_obj_set_style_local_bg_color(btn3, LV_BTN_PART_MAIN, static_cast(ButtonState::NotificationsOff), LV_COLOR_RED); - static constexpr lv_color_t violet = LV_COLOR_MAKE(0x60, 0x00, 0xff); - lv_obj_set_style_local_bg_color(btn3, LV_BTN_PART_MAIN, static_cast(ButtonState::Sleep), violet); + lv_obj_set_style_local_bg_color(btn3, + LV_BTN_PART_MAIN, + static_cast(ButtonState::NotificationsOff), + Colors::Red); + lv_obj_set_style_local_bg_color(btn3, + LV_BTN_PART_MAIN, + static_cast(ButtonState::Sleep), + Colors::Violet); lv_obj_set_size(btn3, buttonWidth, buttonHeight); lv_obj_align(btn3, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, buttonXOffset, 0); diff --git a/src/displayapp/screens/settings/SettingDisplay.cpp b/src/displayapp/screens/settings/SettingDisplay.cpp index bbc188a9d7..a5407bc388 100644 --- a/src/displayapp/screens/settings/SettingDisplay.cpp +++ b/src/displayapp/screens/settings/SettingDisplay.cpp @@ -44,7 +44,7 @@ SettingDisplay::SettingDisplay(Pinetime::Controllers::Settings& settingsControll lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15); lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Orange); lv_label_set_text_static(icon, Symbols::sun); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); diff --git a/src/displayapp/screens/settings/SettingSetDate.cpp b/src/displayapp/screens/settings/SettingSetDate.cpp index 93a8da4d27..474c047729 100644 --- a/src/displayapp/screens/settings/SettingSetDate.cpp +++ b/src/displayapp/screens/settings/SettingSetDate.cpp @@ -55,7 +55,7 @@ SettingSetDate::SettingSetDate(Pinetime::Controllers::DateTime& dateTimeControll lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Orange); lv_label_set_text_static(icon, Symbols::clock); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); @@ -81,7 +81,7 @@ SettingSetDate::SettingSetDate(Pinetime::Controllers::DateTime& dateTimeControll btnSetTime->user_data = this; lv_obj_set_size(btnSetTime, 120, 48); lv_obj_align(btnSetTime, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); - 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_DEFAULT, Colors::Color(0x383838)); lblSetTime = lv_label_create(btnSetTime, nullptr); lv_label_set_text_static(lblSetTime, "Set"); lv_obj_set_event_cb(btnSetTime, event_handler); diff --git a/src/displayapp/screens/settings/SettingSetTime.cpp b/src/displayapp/screens/settings/SettingSetTime.cpp index e5a6be2f9b..c62f1d2001 100644 --- a/src/displayapp/screens/settings/SettingSetTime.cpp +++ b/src/displayapp/screens/settings/SettingSetTime.cpp @@ -35,7 +35,7 @@ SettingSetTime::SettingSetTime(Pinetime::Controllers::DateTime& dateTimeControll lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Orange); lv_label_set_text_static(icon, Symbols::clock); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); @@ -69,8 +69,8 @@ SettingSetTime::SettingSetTime(Pinetime::Controllers::DateTime& dateTimeControll lv_obj_align(btnSetTime, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0); lblSetTime = lv_label_create(btnSetTime, nullptr); lv_label_set_text_static(lblSetTime, "Set"); - lv_obj_set_style_local_bg_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); - lv_obj_set_style_local_text_color(lblSetTime, LV_LABEL_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_GRAY); + lv_obj_set_style_local_bg_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); + lv_obj_set_style_local_text_color(lblSetTime, LV_LABEL_PART_MAIN, LV_STATE_DISABLED, Colors::Gray); lv_obj_set_event_cb(btnSetTime, SetTimeEventHandler); UpdateScreen(); diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp index be67cc9563..81f4ae615e 100644 --- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp +++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp @@ -43,7 +43,7 @@ SettingShakeThreshold::SettingShakeThreshold(Controllers::Settings& settingsCont lv_obj_set_style_local_line_opa(animArc, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0); lv_obj_set_style_local_line_opa(animArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, LV_OPA_70); lv_obj_set_style_local_line_opa(animArc, LV_ARC_PART_KNOB, LV_STATE_DEFAULT, LV_OPA_0); - lv_obj_set_style_local_line_color(animArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_obj_set_style_local_line_color(animArc, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, Colors::Red); lv_obj_set_style_local_bg_color(animArc, LV_ARC_PART_BG, LV_STATE_CHECKED, LV_COLOR_TRANSP); animArc->user_data = this; @@ -89,8 +89,8 @@ void SettingShakeThreshold::Refresh() { if (xTaskGetTickCount() - vCalTime > pdMS_TO_TICKS(2000)) { vCalTime = xTaskGetTickCount(); calibrating = 2; - lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_RED); - lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_RED); + lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, Colors::Red); + lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, Colors::Red); lv_label_set_text_static(calLabel, "Shake!"); } } @@ -123,7 +123,7 @@ void SettingShakeThreshold::UpdateSelected(lv_obj_t* object, lv_event_t event) { 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, Colors::highlight); + lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, InfiniTimeTheme::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 b8d5c4055a..ce68c13c97 100644 --- a/src/displayapp/screens/settings/SettingSteps.cpp +++ b/src/displayapp/screens/settings/SettingSteps.cpp @@ -32,7 +32,7 @@ SettingSteps::SettingSteps(Pinetime::Controllers::Settings& settingsController) lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Orange); lv_label_set_text_static(icon, Symbols::shoe); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); @@ -51,7 +51,7 @@ SettingSteps::SettingSteps(Pinetime::Controllers::Settings& settingsController) btnPlus->user_data = this; lv_obj_set_size(btnPlus, btnWidth, btnHeight); lv_obj_align(btnPlus, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); - lv_obj_set_style_local_bg_color(btnPlus, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_bg_color(btnPlus, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); lv_obj_t* lblPlus = lv_label_create(btnPlus, nullptr); lv_obj_set_style_local_text_font(lblPlus, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); lv_label_set_text_static(lblPlus, "+"); @@ -62,7 +62,7 @@ SettingSteps::SettingSteps(Pinetime::Controllers::Settings& settingsController) lv_obj_set_size(btnMinus, btnWidth, btnHeight); lv_obj_set_event_cb(btnMinus, event_handler); lv_obj_align(btnMinus, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); - lv_obj_set_style_local_bg_color(btnMinus, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_bg_color(btnMinus, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); lv_obj_t* lblMinus = lv_label_create(btnMinus, nullptr); lv_obj_set_style_local_text_font(lblMinus, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); lv_label_set_text_static(lblMinus, "-"); diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp index 3413257dc3..4f9ce857d6 100644 --- a/src/displayapp/screens/settings/SettingWakeUp.cpp +++ b/src/displayapp/screens/settings/SettingWakeUp.cpp @@ -36,7 +36,7 @@ SettingWakeUp::SettingWakeUp(Pinetime::Controllers::Settings& settingsController lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::Orange); lv_label_set_text_static(icon, Symbols::eye); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); diff --git a/src/displayapp/widgets/Counter.cpp b/src/displayapp/widgets/Counter.cpp index b486e3727f..d8a4addea0 100644 --- a/src/displayapp/widgets/Counter.cpp +++ b/src/displayapp/widgets/Counter.cpp @@ -122,7 +122,7 @@ void Counter::SetValueChangedEventCallback(void* userData, void (*handler)(void* void Counter::Create() { counterContainer = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(counterContainer, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_bg_color(counterContainer, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgAlt); number = lv_label_create(counterContainer, nullptr); lv_obj_set_style_local_text_font(number, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &font); @@ -144,7 +144,7 @@ void Counter::Create() { UpdateLabel(); upBtn = lv_btn_create(counterContainer, nullptr); - lv_obj_set_style_local_bg_color(upBtn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt); + lv_obj_set_style_local_bg_color(upBtn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::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; @@ -156,7 +156,7 @@ void Counter::Create() { 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, Colors::bgAlt); + lv_obj_set_style_local_bg_color(downBtn, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::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; @@ -174,7 +174,7 @@ void Counter::Create() { lv_obj_t* line = lv_line_create(counterContainer, nullptr); lv_line_set_points(line, linePoints, 2); lv_obj_set_style_local_line_width(line, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 1); - lv_obj_set_style_local_line_color(line, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_line_color(line, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::White); lv_obj_set_style_local_line_opa(line, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20); return line; }; diff --git a/src/displayapp/widgets/DotIndicator.cpp b/src/displayapp/widgets/DotIndicator.cpp index 209b43bdc3..ea889236a6 100644 --- a/src/displayapp/widgets/DotIndicator.cpp +++ b/src/displayapp/widgets/DotIndicator.cpp @@ -19,10 +19,10 @@ void DotIndicator::Create() { for (int i = 0; i < nScreens; i++) { dotIndicator[i] = lv_obj_create(container, nullptr); lv_obj_set_size(dotIndicator[i], dotSize, dotSize); - lv_obj_set_style_local_bg_color(dotIndicator[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); + lv_obj_set_style_local_bg_color(dotIndicator[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::Gray); } - lv_obj_set_style_local_bg_color(dotIndicator[nCurrentScreen], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_bg_color(dotIndicator[nCurrentScreen], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::White); lv_obj_align(container, nullptr, LV_ALIGN_IN_RIGHT_MID, 0, 0); } diff --git a/src/displayapp/widgets/PageIndicator.cpp b/src/displayapp/widgets/PageIndicator.cpp index 84d03e7ed0..72b6eee1ef 100644 --- a/src/displayapp/widgets/PageIndicator.cpp +++ b/src/displayapp/widgets/PageIndicator.cpp @@ -1,5 +1,6 @@ #include "displayapp/widgets/PageIndicator.h" #include "displayapp/InfiniTimeTheme.h" +#include "displayapp/Colors.h" using namespace Pinetime::Applications::Widgets; @@ -14,7 +15,7 @@ void PageIndicator::Create() { 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, Colors::bgDark); + lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, InfiniTimeTheme::Colors::bgDark); lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2); const int16_t indicatorSize = LV_VER_RES / nScreens; @@ -27,6 +28,6 @@ void PageIndicator::Create() { 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, Colors::lightGray); + lv_obj_set_style_local_line_color(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, Colors::LightGray); lv_line_set_points(pageIndicator, pageIndicatorPoints, 2); }