diff --git a/CYD-Klipper/src/conf/global_config.cpp b/CYD-Klipper/src/conf/global_config.cpp index 978e1b9..5754ee4 100644 --- a/CYD-Klipper/src/conf/global_config.cpp +++ b/CYD-Klipper/src/conf/global_config.cpp @@ -5,13 +5,13 @@ GLOBAL_CONFIG global_config = {0}; COLOR_DEF color_defs[] = { - {LV_PALETTE_BLUE, LV_PALETTE_RED}, - {LV_PALETTE_GREEN, LV_PALETTE_PURPLE}, - {LV_PALETTE_GREY, LV_PALETTE_CYAN}, - {LV_PALETTE_YELLOW, LV_PALETTE_PINK}, - {LV_PALETTE_ORANGE, LV_PALETTE_BLUE}, - {LV_PALETTE_RED, LV_PALETTE_GREEN}, - {LV_PALETTE_PURPLE, LV_PALETTE_GREY}, + {LV_PALETTE_BLUE, 0, LV_PALETTE_RED}, + {LV_PALETTE_LIME, -2, LV_PALETTE_PURPLE}, + {LV_PALETTE_BLUE, 0, LV_PALETTE_CYAN}, + {LV_PALETTE_YELLOW, -2, LV_PALETTE_PINK}, + {LV_PALETTE_ORANGE, -2, LV_PALETTE_BLUE}, + {LV_PALETTE_RED, 0, LV_PALETTE_GREEN}, + {LV_PALETTE_PURPLE, 0, LV_PALETTE_GREY}, }; void WriteGlobalConfig() { diff --git a/CYD-Klipper/src/conf/global_config.h b/CYD-Klipper/src/conf/global_config.h index 975315a..922b14e 100644 --- a/CYD-Klipper/src/conf/global_config.h +++ b/CYD-Klipper/src/conf/global_config.h @@ -10,9 +10,12 @@ typedef struct _GLOBAL_CONFIG { union { unsigned char raw; struct { + // Internal bool screenCalibrated : 1; bool wifiConfigured : 1; bool ipConfigured : 1; + + // External bool lightMode : 1; bool invertColors : 1; bool rotateScreen : 1; @@ -40,6 +43,7 @@ typedef struct _GLOBAL_CONFIG { typedef struct _COLOR_DEF { lv_palette_t primary_color; + short primary_color_light; lv_palette_t secondary_color; } COLOR_DEF; diff --git a/CYD-Klipper/src/core/screen_driver.cpp b/CYD-Klipper/src/core/screen_driver.cpp index ce6bfa8..e419ab5 100644 --- a/CYD-Klipper/src/core/screen_driver.cpp +++ b/CYD-Klipper/src/core/screen_driver.cpp @@ -183,7 +183,20 @@ void screen_lv_touchRead(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) void set_color_scheme(){ lv_disp_t *dispp = lv_disp_get_default(); - lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(color_defs[global_config.color_scheme].primary_color), lv_palette_main(color_defs[global_config.color_scheme].secondary_color), !global_config.lightMode, LV_FONT_DEFAULT); + lv_color_t main_color = {0}; + COLOR_DEF color_def = color_defs[global_config.color_scheme]; + + if (color_defs[global_config.color_scheme].primary_color_light > 0){ + main_color = lv_palette_lighten(color_def.primary_color, color_def.primary_color_light); + } + else if (color_defs[global_config.color_scheme].primary_color_light < 0) { + main_color = lv_palette_darken(color_def.primary_color, color_def.primary_color_light * -1); + } + else { + main_color = lv_palette_main(color_defs[global_config.color_scheme].primary_color); + } + + lv_theme_t *theme = lv_theme_default_init(dispp, main_color, lv_palette_main(color_def.secondary_color), !global_config.lightMode, LV_FONT_DEFAULT); lv_disp_set_theme(dispp, theme); }