Skip to content

Commit 1bf7bbb

Browse files
committed
fw/apps/system: Apply dark mode to system apps
Signed-off-by: Andrew McOlash <amcolash@gmail.com>
1 parent 59bdd0d commit 1bf7bbb

8 files changed

Lines changed: 31 additions & 32 deletions

File tree

src/fw/apps/system/alarms/alarms.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ static void prv_push_alarms_app_opened_dialog(AlarmsAppData *data) {
353353
const char *header = i18n_get("Smart Alarm", data);
354354
ExpandableDialog *expandable_dialog = expandable_dialog_create_with_params(
355355
header, RESOURCE_ID_SMART_ALARM_TINY, first_use_text,
356-
GColorBlack, GColorWhite, NULL, RESOURCE_ID_ACTION_BAR_ICON_CHECK,
356+
system_theme_get_fg_color(), system_theme_get_bg_color(), NULL, RESOURCE_ID_ACTION_BAR_ICON_CHECK,
357357
prv_alarms_app_opened_click_handler);
358358

359359
expandable_dialog_set_action_bar_background_color(expandable_dialog, ALARMS_APP_HIGHLIGHT_COLOR);
@@ -403,8 +403,6 @@ static void prv_handle_init(void) {
403403
layer_add_child(&data->window.layer, menu_layer_get_layer(&data->menu_layer));
404404

405405
status_bar_layer_init(&data->status_layer);
406-
status_bar_layer_set_colors(&data->status_layer, PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack),
407-
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
408406
status_bar_layer_set_separator_mode(&data->status_layer, StatusBarLayerSeparatorModeNone);
409407
layer_add_child(&data->window.layer, status_bar_layer_get_layer(&data->status_layer));
410408

src/fw/apps/system/health/health.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "pbl/services/activity/activity_private.h"
1717
#include "pbl/services/timeline/timeline.h"
1818
#include "resource/resource_ids.auto.h"
19+
#include "shell/system_theme.h"
1920
#include "system/logging.h"
2021

2122
// Health app versions
@@ -84,8 +85,8 @@ static void prv_show_insights_onboarding_dialog(void) {
8485
"Insights Onboarding",
8586
RESOURCE_ID_HEALTH_ICON_MOON,
8687
text,
87-
GColorBlack,
88-
GColorWhite,
88+
system_theme_get_fg_color(),
89+
system_theme_get_bg_color(),
8990
NULL,
9091
RESOURCE_ID_ACTION_BAR_ICON_CHECK,
9192
expandable_dialog_close_cb);

src/fw/apps/system/health/hr_detail_card.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "pbl/services/i18n/i18n.h"
1010
#include "pbl/services/activity/activity.h"
1111
#include "pbl/services/activity/health_util.h"
12+
#include "shell/system_theme.h"
1213

1314
#include <stdio.h>
1415

@@ -89,7 +90,7 @@ Window *health_hr_detail_card_create(HealthData *health_data) {
8990
.num_headings = card_data->num_headings,
9091
.headings = card_data->headings,
9192
.weekly_max = max_progress,
92-
.bg_color = GColorWhite,
93+
.bg_color = system_theme_get_bg_color(),
9394
.num_zones = card_data->num_zones,
9495
.zones = card_data->zones,
9596
.data = card_data,

src/fw/apps/system/launcher/default/app_glance_structured.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "resource/resource_ids.auto.h"
1414
#include "pbl/services/timeline/attribute.h"
1515
#include "shell/prefs.h"
16+
#include "shell/system_theme.h"
1617
#include "system/passert.h"
1718
#include "util/attributes.h"
1819
#include "util/string.h"
@@ -87,16 +88,9 @@ static void prv_structured_glance_icon_bitmap_processor_post_func(
8788

8889
GColor launcher_app_glance_structured_get_highlight_color(
8990
LauncherAppGlanceStructured *structured_glance) {
90-
#if PBL_COLOR
91-
if (structured_glance->glance.is_highlighted) {
92-
GColor highlight_bg = shell_prefs_get_theme_highlight_color();
93-
return gcolor_legible_over(highlight_bg);
94-
} else {
95-
return GColorBlack;
96-
}
97-
#else
98-
return structured_glance->glance.is_highlighted ? GColorWhite : GColorBlack;
99-
#endif
91+
return structured_glance->glance.is_highlighted ?
92+
gcolor_legible_over(shell_prefs_get_theme_highlight_color()) :
93+
system_theme_get_fg_color();
10094
}
10195

10296
static GColor prv_get_icon_tint_color(LauncherAppGlanceStructured *structured_glance) {
@@ -362,7 +356,7 @@ static GTextNode *prv_create_structured_glance_title_subtitle_node(
362356
GTextNode *title_node = prv_structured_glance_create_title_text_node(structured_glance);
363357
// We require a valid title node
364358
PBL_ASSERTN(title_node);
365-
359+
366360
// Push the margin a bit closer
367361
#if PBL_DISPLAY_HEIGHT >= 200 && PBL_RECT
368362
title_node->margin.h = -3;

src/fw/apps/system/music.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,9 @@ static void prv_no_music_window_click_config(void *context) {
690690
static MusicNoMusicWindow *prv_create_no_music_window(void) {
691691
MusicNoMusicWindow *window = app_malloc_check(sizeof(MusicNoMusicWindow));
692692
window_init(&window->window, WINDOW_NAME("NoMusicWindow"));
693-
window_set_background_color(&window->window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite));
693+
window_set_background_color(&window->window, PBL_IF_COLOR_ELSE(
694+
system_theme_is_dark_mode() ? GColorDarkGray : GColorLightGray,
695+
GColorWhite));
694696
window_set_window_handlers(&window->window, &(WindowHandlers) {
695697
.unload = prv_unload_no_music_window
696698
});
@@ -713,7 +715,7 @@ static MusicNoMusicWindow *prv_create_no_music_window(void) {
713715
&NO_MUSIC_TEXT_RECT,
714716
i18n_get("START PLAYBACK\nON YOUR PHONE", window),
715717
fonts_get_system_font(config->no_music_font_key),
716-
GColorBlack, GColorClear, GTextAlignmentCenter,
718+
system_theme_get_fg_color(), GColorClear, GTextAlignmentCenter,
717719
GTextOverflowModeTrailingEllipsis);
718720
layer_add_child(&window->window.layer, &window->bitmap_layer.layer);
719721
layer_add_child(&window->window.layer, &window->text_layer.layer);
@@ -834,15 +836,17 @@ static void prv_configure_music_text_layer(
834836
TextLayer *text_layer, char* text_buffer, const GRect *rect, int16_t y_offset,
835837
GTextAlignment align, GFont font) {
836838
text_layer_init_with_parameters(text_layer, rect, text_buffer, font,
837-
GColorBlack, GColorClear, align, GTextOverflowModeFill);
839+
system_theme_get_fg_color(), GColorClear, align, GTextOverflowModeFill);
838840
layer_set_bounds(&text_layer->layer, &GRect(0, -y_offset,
839841
rect->size.w, rect->size.h + y_offset));
840842
}
841843

842844
static void prv_init_ui(Window *window) {
843845
MusicAppData *data = window_get_user_data(window);
844846

845-
window_set_background_color(window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite));
847+
window_set_background_color(window, PBL_IF_COLOR_ELSE(
848+
system_theme_is_dark_mode() ? GColorDarkGray : GColorLightGray,
849+
GColorWhite));
846850

847851
const GSize WINDOW_SIZE = window->layer.bounds.size;
848852

@@ -896,7 +900,7 @@ static void prv_init_ui(Window *window) {
896900

897901
progress_layer_init(&data->track_pos_bar, &track_rect);
898902
progress_layer_set_background_color(&data->track_pos_bar,
899-
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
903+
PBL_IF_COLOR_ELSE(system_theme_get_bg_color(), GColorWhite));
900904
progress_layer_set_foreground_color(&data->track_pos_bar,
901905
PBL_IF_COLOR_ELSE(GColorRed, GColorBlack));
902906
progress_layer_set_corner_radius(&data->track_pos_bar, config->track_corner_radius);
@@ -915,7 +919,7 @@ static void prv_init_ui(Window *window) {
915919
WINDOW_SIZE.w);
916920
status_layer_frame.size.w = STATUS_BAR_LAYER_WIDTH;
917921
layer_set_frame(&status_layer->layer, &status_layer_frame);
918-
status_bar_layer_set_colors(&data->status_layer, GColorClear, GColorBlack);
922+
status_bar_layer_set_colors(&data->status_layer, GColorClear, system_theme_get_fg_color());
919923
layer_add_child(&data->window.layer, &status_layer->layer);
920924

921925
music_get_pos(&data->track_pos, &data->track_length);

src/fw/apps/system/notifications.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -711,10 +711,10 @@ static void prv_window_load(Window *window) {
711711
.select_click = prv_select_callback,
712712
});
713713

714-
menu_layer_set_normal_colors(menu_layer, GColorWhite, GColorBlack);
714+
menu_layer_set_normal_colors(menu_layer, system_theme_get_bg_color(), system_theme_get_fg_color());
715715
menu_layer_set_highlight_colors(menu_layer,
716-
PBL_IF_COLOR_ELSE(DEFAULT_NOTIFICATION_COLOR, GColorBlack),
717-
GColorWhite);
716+
PBL_IF_COLOR_ELSE(DEFAULT_NOTIFICATION_COLOR, system_theme_get_fg_color()),
717+
system_theme_get_bg_color());
718718

719719
menu_layer_set_click_config_onto_window(menu_layer, window);
720720
menu_layer_set_scroll_wrap_around(menu_layer, shell_prefs_get_menu_scroll_wrap_around_enable());
@@ -730,14 +730,14 @@ static void prv_window_load(Window *window) {
730730
&GRect(horizontal_margin, window->layer.bounds.size.h / 2 - 15,
731731
window->layer.bounds.size.w - horizontal_margin,
732732
window->layer.bounds.size.h / 2),
733-
i18n_get("No notifications", data), font, GColorBlack,
734-
GColorWhite, GTextAlignmentCenter,
733+
i18n_get("No notifications", data), font, system_theme_get_fg_color(),
734+
system_theme_get_bg_color(), GTextAlignmentCenter,
735735
GTextOverflowModeTrailingEllipsis);
736736
layer_add_child(&window->layer, text_layer_get_layer(text_layer));
737737

738738
#if PBL_ROUND
739739
GColor bg_color = GColorClear;
740-
GColor fg_color = GColorBlack;
740+
GColor fg_color = system_theme_get_fg_color();
741741

742742
StatusBarLayer *status_bar = &data->status_bar_layer;
743743
status_bar_layer_init(status_bar);

src/fw/apps/system/weather/layout.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "pbl/services/timeline/timeline_resources.h"
2828
#include "pbl/services/weather/weather_service.h"
2929
#include "pbl/services/weather/weather_types.h"
30+
#include "shell/system_theme.h"
3031
#include "system/logging.h"
3132
#include "system/passert.h"
3233
#include "util/size.h"
@@ -318,8 +319,8 @@ static void prv_content_indicator_setup_direction(ContentIndicator *content_indi
318319
ContentIndicatorDirection direction) {
319320
content_indicator_configure_direction(content_indicator, direction, &(ContentIndicatorConfig) {
320321
.layer = indicator_layer,
321-
.colors.foreground = GColorBlack,
322-
.colors.background = GColorWhite,
322+
.colors.foreground = system_theme_get_fg_color(),
323+
.colors.background = system_theme_get_bg_color(),
323324
});
324325
}
325326

src/fw/apps/system/workout/selection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ WorkoutSelectionWindow *workout_selection_push(SelectWorkoutCallback select_work
176176
.draw_row = prv_draw_row_callback,
177177
.select_click = prv_select_callback,
178178
});
179-
menu_layer_set_normal_colors(menu_layer, GColorWhite, GColorBlack);
179+
menu_layer_set_normal_colors(menu_layer, system_theme_get_bg_color(), system_theme_get_fg_color());
180180
menu_layer_set_highlight_colors(menu_layer,
181181
PBL_IF_COLOR_ELSE(GColorYellow, GColorBlack),
182182
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));

0 commit comments

Comments
 (0)