From c0bb88799c2de0ab8de5d38b3eb511f4f80029d7 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Sun, 15 Aug 2021 12:33:32 +0200 Subject: Add check for randomise button in case colors clash --- src/displayapp/screens/settings/SettingPineTimeStyle.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/displayapp/screens/settings') 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]); -- cgit v1.2.3