Skip to content

Commit c0bb887

Browse files
committed
Add check for randomise button in case colors clash
1 parent 477ff32 commit c0bb887

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/displayapp/screens/settings/SettingPineTimeStyle.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t *object, lv_event_t event) {
315315
uint8_t randTime = rand() % 17;
316316
uint8_t randBar = rand() % 17;
317317
uint8_t randBG = rand() % 17;
318+
// 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.
319+
if ((randTime == randBG) || (randBar == 3)) {
320+
randBG += 1;
321+
randBar = randTime;
322+
}
318323
settingsController.SetPTSColorTime(randTime);
319324
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]);
320325
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]);

0 commit comments

Comments
 (0)