From b36fd4c8bfd38dda01be47a8a4434ded18135b08 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 28 Jun 2026 17:35:07 -0400 Subject: [PATCH] Use new recolor helper in bt_callback --- src/c/main.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/c/main.c b/src/c/main.c index 9594a20..8b19fe2 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -96,6 +96,15 @@ static void toggle_temp_warning_state(bool enable_warning, bool force) { s_temp_is_warning = enable_warning; } +static void recolor_digit_bitmaps(GBitmap **bitmaps, GColor *applied, GColor new_color) { + if (applied->argb == new_color.argb) + return; + for (int i = 0; i < 10; ++i) { + replace_gbitmap_color(*applied, new_color, bitmaps[i], NULL); + } + *applied = new_color; +} + static void bt_callback(bool connected) { GColor dst = connected ? settings.ColorHours : settings.ColorWarning; if (s_first_settings_application && connected && dst.argb == s_applied_hour.argb) { @@ -103,13 +112,10 @@ static void bt_callback(bool connected) { // for those using white fg, do not pointlessly replace white at startup if that is the destination anyway return; } - for (int i = 0; i < 10; ++i) { - replace_gbitmap_color(s_applied_hour, dst, s_hour_bitmaps[i], NULL); - } + recolor_digit_bitmaps(s_hour_bitmaps, &s_applied_hour, dst); for (int i = 0; i < 4; ++i) { layer_mark_dirty(bitmap_layer_get_layer(s_digit_fg_layers[i])); } - s_applied_hour = dst; } static void batt_callback(BatteryChargeState state) { @@ -310,15 +316,6 @@ static void peek_did_change(void *context) { } } -static void recolor_digit_bitmaps(GBitmap **bitmaps, GColor *applied, GColor new_color) { - if (applied->argb == new_color.argb) - return; - for (int i = 0; i < 10; ++i) { - replace_gbitmap_color(*applied, new_color, bitmaps[i], NULL); - } - *applied = new_color; -} - static void apply_settings() { bool force_update_minutes = false;