this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

dark mode 1.0.1

alice 85b45adb 881b1a36

+71 -8
+2 -1
README.md
··· 1 - ![screenshot](screenshot.png) 1 + ![Light mode](screenshot_light.png) 2 + ![Dark mode](screenshot_dark.png) 2 3 3 4 # TID clock (and other watchfaces for pebble) 4 5
+3 -2
package.json
··· 1 1 { 2 2 "name": "tidface", 3 3 "author": "aliceisjustplaying", 4 - "version": "1.0.0", 4 + "version": "1.0.1", 5 5 "keywords": [ 6 6 "pebble-app" 7 7 ], ··· 23 23 "watchface": true 24 24 }, 25 25 "messageKeys": [ 26 - "timeAlignmentMode" 26 + "timeAlignmentMode", 27 + "colorScheme" 27 28 ], 28 29 "resources": { 29 30 "media": []
screenshot.png screenshot_light.png
screenshot_dark.png

This is a binary file and will not be displayed.

+42 -2
src/c/watchface.c
··· 26 26 MODE_5PM = 1 27 27 } TargetTimeMode; 28 28 29 + typedef enum { 30 + COLOR_LIGHT = 0, 31 + COLOR_DARK = 1 32 + } ColorScheme; 33 + 29 34 typedef struct AppSettings { 30 35 TargetTimeMode target_time_mode; 36 + ColorScheme color_scheme; 31 37 } AppSettings; 32 38 39 + // Forward declare helper to apply colors across UI 40 + static void apply_color_scheme(); 41 + 33 42 static AppSettings settings; 34 43 35 44 // --- Window and Layer Globals --- ··· 46 55 static void load_settings() { 47 56 // Set default values 48 57 settings.target_time_mode = MODE_NOON; 58 + settings.color_scheme = COLOR_LIGHT; 49 59 // Read settings from persistent storage, if they exist 50 60 persist_read_data(SETTINGS_KEY, &settings, sizeof(settings)); 51 61 } ··· 73 83 APP_LOG(APP_LOG_LEVEL_WARNING, "Key timeAlignmentMode not found!"); 74 84 } 75 85 86 + // Read color scheme preference 87 + Tuple *color_scheme_t = dict_find(iter, MESSAGE_KEY_colorScheme); 88 + if (color_scheme_t) { 89 + int recv_val = (int)color_scheme_t->value->int32; 90 + settings.color_scheme = (recv_val == 49) ? COLOR_DARK : COLOR_LIGHT; 91 + } 92 + 76 93 // Save the new settings 77 94 save_settings(); 95 + 96 + // Apply updated colors immediately 97 + apply_color_scheme(); 78 98 79 99 // Potentially force an update if needed (e.g., re-pick airport) 80 100 s_last_re_eval_time = -1; // Force re-evaluation on next tick ··· 119 139 // Create airport name line below the IATA code 120 140 s_airport_noon_name_layer = text_layer_create(GRect(3, name_h, bounds.size.w - 5, name_h)); 121 141 text_layer_set_font(s_airport_noon_name_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24)); 142 + text_layer_set_background_color(s_airport_noon_name_layer, GColorClear); // Make background transparent 122 143 text_layer_set_text_alignment(s_airport_noon_name_layer, GTextAlignmentCenter); 123 144 layer_add_child(window_layer, text_layer_get_layer(s_airport_noon_name_layer)); 124 145 // Create hero time line, vertically centered ··· 143 164 s_beat_layer = clock_beat_init(GRect(0, footer_y + tid_h - 3, w, beat_h), window_layer); 144 165 text_layer_set_font(s_beat_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18)); 145 166 text_layer_set_text_alignment(s_beat_layer, GTextAlignmentCenter); 167 + 168 + // Apply color scheme to layers 169 + apply_color_scheme(); 146 170 } 147 171 148 172 static void main_window_unload(Window *window) { ··· 167 191 168 192 // Create main Window element and assign to pointer 169 193 s_main_window = window_create(); 170 - // Ensure text layers with clear background show up on white 171 - window_set_background_color(s_main_window, GColorWhite); 194 + // Set initial background color based on saved settings 195 + window_set_background_color(s_main_window, (settings.color_scheme == COLOR_DARK) ? GColorBlack : GColorWhite); 172 196 173 197 // Set handlers to manage the elements inside the Window 174 198 window_set_window_handlers( ··· 202 226 static void deinit() { 203 227 tick_timer_service_unsubscribe(); 204 228 window_destroy(s_main_window); 229 + } 230 + 231 + // --- Helper: Apply Color Scheme --- 232 + static void apply_color_scheme() { 233 + GColor bg = (settings.color_scheme == COLOR_DARK) ? GColorBlack : GColorWhite; 234 + GColor fg = (settings.color_scheme == COLOR_DARK) ? GColorWhite : GColorBlack; 235 + 236 + if (s_main_window) { 237 + window_set_background_color(s_main_window, bg); 238 + } 239 + 240 + if (s_airport_noon_code_layer) text_layer_set_text_color(s_airport_noon_code_layer, fg); 241 + if (s_airport_noon_name_layer) text_layer_set_text_color(s_airport_noon_name_layer, fg); 242 + if (s_airport_noon_time_layer) text_layer_set_text_color(s_airport_noon_time_layer, fg); 243 + if (s_tid_layer) text_layer_set_text_color(s_tid_layer, fg); 244 + if (s_beat_layer) text_layer_set_text_color(s_beat_layer, fg); 205 245 } 206 246 207 247 int main(void) {
+24 -3
src/pkjs/config.js
··· 13 13 items: [ 14 14 { 15 15 type: "radiogroup", 16 - defaultValue: 0, 16 + defaultValue: "0", 17 17 label: "Time alignment mode", 18 18 messageKey: "timeAlignmentMode", 19 19 options: [ 20 20 { 21 21 label: "Noon", 22 - value: 0, 22 + value: "0", 23 23 }, 24 24 { 25 25 label: "It's 5 o'clock somewhere", 26 - value: 1, 26 + value: "1", 27 + }, 28 + ], 29 + }, 30 + ], 31 + }, 32 + { 33 + type: "section", 34 + items: [ 35 + { 36 + type: "radiogroup", 37 + defaultValue: "0", 38 + label: "Color scheme", 39 + messageKey: "colorScheme", 40 + options: [ 41 + { 42 + label: "Light mode", 43 + value: "0", 44 + }, 45 + { 46 + label: "Dark mode", 47 + value: "1", 27 48 }, 28 49 ], 29 50 },