summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Cawthray <kieranc@gmail.com>2021-08-15 12:33:32 +0200
committerKieran Cawthray <kieranc@gmail.com>2021-08-15 12:33:32 +0200
commitc0bb88799c2de0ab8de5d38b3eb511f4f80029d7 (patch)
treed018dc0edb9cf7e6411b4c43ee353016440d8b8d
parent477ff32edc3bc0997f45d943f90f68f8f0608468 (diff)
Add check for randomise button in case colors clash
-rw-r--r--src/displayapp/screens/settings/SettingPineTimeStyle.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp
index a32ce34d..007c1cff 100644
--- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp
+++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp
@@ -315,6 +315,11 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) {
uint8_t randTime = rand() % 17;
uint8_t randBar = rand() % 17;
uint8_t randBG = rand() % 17;
+ // Check if the time color is the same as its background, or if the sidebar is black. If so, change them to more useful values.
+ if ((randTime == randBG) || (randBar == 3)) {
+ randBG += 1;
+ randBar = randTime;
+ }
settingsController.SetPTSColorTime(randTime);
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]);
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]);