Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/fw/applib/ui/date_selection_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static void prv_handle_dec(unsigned index, void *context) {
// ---------------------------------------------------------------------------

static void prv_text_layer_init(Layer *window_layer, TextLayer *text_layer, const GFont font) {
text_layer_init_with_parameters(text_layer, &GRectZero, NULL, font, GColorBlack, GColorClear,
text_layer_init_with_parameters(text_layer, &GRectZero, NULL, font, system_theme_get_fg_color(), GColorClear,
GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis);
layer_add_child(window_layer, &text_layer->layer);
layer_set_hidden(&text_layer->layer, true);
Expand Down Expand Up @@ -220,9 +220,6 @@ void date_selection_window_init(DateSelectionWindowData *window, const char *lab

// Status bar setup
status_bar_layer_init(&window->status_layer);
status_bar_layer_set_colors(&window->status_layer,
PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack),
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
status_bar_layer_set_separator_mode(&window->status_layer,
PBL_IF_COLOR_ELSE(OPTION_MENU_STATUS_SEPARATOR_MODE,
StatusBarLayerSeparatorModeNone));
Expand Down
8 changes: 5 additions & 3 deletions src/fw/applib/ui/menu_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "applib/legacy2/ui/menu_layer_legacy2.h"
#include "kernel/pbl_malloc.h"
#include "process_management/process_manager.h"
#include "shell/prefs.h"
#include "shell/system_theme.h"
#include "system/logging.h"
#include "system/passert.h"
Expand Down Expand Up @@ -695,8 +696,9 @@ void menu_layer_init(MenuLayer *menu_layer, const GRect *frame) {
scroll_layer_set_shadow_hidden(scroll_layer, true);
scroll_layer_set_context(scroll_layer, menu_layer);

menu_layer_set_normal_colors(menu_layer, GColorWhite, GColorBlack);
menu_layer_set_highlight_colors(menu_layer, GColorBlack, GColorWhite);
menu_layer_set_normal_colors(menu_layer, system_theme_get_bg_color(), system_theme_get_fg_color());
GColor highlight_bg = shell_prefs_get_theme_highlight_color();
menu_layer_set_highlight_colors(menu_layer, highlight_bg, gcolor_legible_over(highlight_bg));

InverterLayer *inverter = &menu_layer->inverter;
inverter_layer_init(inverter, &GRectZero);
Expand Down Expand Up @@ -1419,7 +1421,7 @@ void menu_layer_set_scroll_vibe_on_blocked(MenuLayer *menu_layer, bool scroll_vi
if (!menu_layer) {
return;
}

if (scroll_vibe_on_blocked) {
menu_layer->scroll_vibe_on_wrap_around = false;
}
Expand Down
3 changes: 2 additions & 1 deletion src/fw/applib/ui/number_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "applib/applib_malloc.auto.h"
#include "kernel/ui/kernel_ui.h"
#include "kernel/ui/system_icons.h"
#include "shell/system_theme.h"
#include "util/size.h"

#include <stdio.h>
Expand Down Expand Up @@ -94,7 +95,7 @@ void prv_update_proc(Layer *layer, GContext* ctx) {
_Static_assert(offsetof(NumberWindow, window) == 0, "");
NumberWindow *nw = (NumberWindow*) layer;

graphics_context_set_text_color(ctx, GColorBlack);
graphics_context_set_text_color(ctx, system_theme_get_fg_color());

GRect frame = prv_get_text_frame(layer);
frame.size.h = 54;
Expand Down
5 changes: 3 additions & 2 deletions src/fw/applib/ui/progress_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "applib/graphics/gtypes.h"
#include "applib/graphics/graphics.h"
#include "applib/ui/layer.h"
#include "shell/system_theme.h"
#include "util/math.h"

#include <string.h>
Expand Down Expand Up @@ -49,8 +50,8 @@ void progress_layer_init(ProgressLayer* progress_layer, const GRect *frame) {

layer_init(&progress_layer->layer, frame);
progress_layer->layer.update_proc = (LayerUpdateProc) progress_layer_update_proc;
progress_layer->foreground_color = GColorBlack;
progress_layer->background_color = GColorWhite;
progress_layer->foreground_color = system_theme_get_fg_color();
progress_layer->background_color = system_theme_get_bg_color();
progress_layer->corner_radius = 1;
}

Expand Down
5 changes: 3 additions & 2 deletions src/fw/applib/ui/status_bar_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "kernel/ui/kernel_ui.h"
#include "process_state/app_state/app_state.h"
#include "pbl/services/clock.h"
#include "shell/system_theme.h"
#include "syscall/syscall.h"
#include "syscall/syscall_internal.h"
#include "system/passert.h"
Expand Down Expand Up @@ -104,8 +105,8 @@ void status_bar_layer_init(StatusBarLayer *status_bar_layer) {
event_service_client_subscribe(&(status_bar_layer->tick_event));

status_bar_layer->config = (StatusBarLayerConfig){
.foreground_color = GColorWhite,
.background_color = GColorBlack,
.foreground_color = system_theme_get_fg_color(),
.background_color = system_theme_get_bg_color(),
.separator.mode = StatusBarLayerSeparatorModeNone,
};

Expand Down
2 changes: 1 addition & 1 deletion src/fw/applib/ui/time_range_selection_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static void prv_text_layer_init(Window *window, TextLayer *text_layer, GRect *re
const char *i18n_str) {
const GFont subtitle_font = system_theme_get_font_for_default_size(TextStyleFont_Subtitle);
text_layer_init_with_parameters(text_layer, rect, i18n_get(i18n_str, window),
subtitle_font, GColorBlack, GColorClear, GTextAlignmentCenter,
subtitle_font, system_theme_get_fg_color(), GColorClear, GTextAlignmentCenter,
GTextOverflowModeTrailingEllipsis);
layer_add_child(&window->layer, &text_layer->layer);
}
Expand Down
5 changes: 1 addition & 4 deletions src/fw/applib/ui/time_selection_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void time_selection_window_configure(TimeSelectionWindowData *time_selection_win
}

static void prv_text_layer_init(Layer *window_layer, TextLayer *text_layer, const GFont font) {
text_layer_init_with_parameters(text_layer, &GRectZero, NULL, font, GColorBlack, GColorClear,
text_layer_init_with_parameters(text_layer, &GRectZero, NULL, font, system_theme_get_fg_color(), GColorClear,
GTextAlignmentCenter, GTextOverflowModeTrailingEllipsis);
layer_add_child(window_layer, &text_layer->layer);
layer_set_hidden(&text_layer->layer, true);
Expand Down Expand Up @@ -272,9 +272,6 @@ void time_selection_window_init(TimeSelectionWindowData *time_selection_window,

// Status setup
status_bar_layer_init(&time_selection_window->status_layer);
status_bar_layer_set_colors(&time_selection_window->status_layer,
PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack),
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
status_bar_layer_set_separator_mode(&time_selection_window->status_layer,
PBL_IF_COLOR_ELSE(OPTION_MENU_STATUS_SEPARATOR_MODE,
StatusBarLayerSeparatorModeNone));
Expand Down
7 changes: 4 additions & 3 deletions src/fw/applib/ui/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "kernel/ui/modals/modal_manager.h"
#include "process_management/process_manager.h"
#include "process_state/app_state/app_state.h"
#include "shell/system_theme.h"
#include "system/logging.h"
#include "system/passert.h"
#include "syscall/syscall.h"
Expand Down Expand Up @@ -89,8 +90,8 @@ void prv_render_legacy2_system_status_bar(GContext *ctx, Window *window) {
grect_clip(&ctx->draw_state.clip_box, &window->layer.frame);

StatusBarLayerConfig config = {
.foreground_color = GColorWhite,
.background_color = GColorBlack,
.foreground_color = system_theme_get_fg_color(),
.background_color = system_theme_get_bg_color(),
.mode = StatusBarLayerModeClock,
};
GRect frame = window->layer.frame;
Expand Down Expand Up @@ -185,7 +186,7 @@ void window_init(Window *window, const char* debug_name) {
window->is_fullscreen = fullscreen;
window->layer.window = window;
window->layer.update_proc = window_do_layer_update_proc;
window->background_color = GColorWhite;
window->background_color = system_theme_get_bg_color();
window->in_click_config_provider = false;
window->is_waiting_for_click_config = false;
window->parent_window_stack = NULL;
Expand Down
4 changes: 1 addition & 3 deletions src/fw/apps/system/alarms/alarms.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ static void prv_push_alarms_app_opened_dialog(AlarmsAppData *data) {
const char *header = i18n_get("Smart Alarm", data);
ExpandableDialog *expandable_dialog = expandable_dialog_create_with_params(
header, RESOURCE_ID_SMART_ALARM_TINY, first_use_text,
GColorBlack, GColorWhite, NULL, RESOURCE_ID_ACTION_BAR_ICON_CHECK,
system_theme_get_fg_color(), system_theme_get_bg_color(), NULL, RESOURCE_ID_ACTION_BAR_ICON_CHECK,
prv_alarms_app_opened_click_handler);

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

status_bar_layer_init(&data->status_layer);
status_bar_layer_set_colors(&data->status_layer, PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack),
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
status_bar_layer_set_separator_mode(&data->status_layer, StatusBarLayerSeparatorModeNone);
layer_add_child(&data->window.layer, status_bar_layer_get_layer(&data->status_layer));

Expand Down
5 changes: 3 additions & 2 deletions src/fw/apps/system/health/health.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "pbl/services/activity/activity_private.h"
#include "pbl/services/timeline/timeline.h"
#include "resource/resource_ids.auto.h"
#include "shell/system_theme.h"
#include "system/logging.h"

// Health app versions
Expand Down Expand Up @@ -84,8 +85,8 @@ static void prv_show_insights_onboarding_dialog(void) {
"Insights Onboarding",
RESOURCE_ID_HEALTH_ICON_MOON,
text,
GColorBlack,
GColorWhite,
system_theme_get_fg_color(),
system_theme_get_bg_color(),
NULL,
RESOURCE_ID_ACTION_BAR_ICON_CHECK,
expandable_dialog_close_cb);
Expand Down
3 changes: 2 additions & 1 deletion src/fw/apps/system/health/hr_detail_card.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "pbl/services/i18n/i18n.h"
#include "pbl/services/activity/activity.h"
#include "pbl/services/activity/health_util.h"
#include "shell/system_theme.h"

#include <stdio.h>

Expand Down Expand Up @@ -89,7 +90,7 @@ Window *health_hr_detail_card_create(HealthData *health_data) {
.num_headings = card_data->num_headings,
.headings = card_data->headings,
.weekly_max = max_progress,
.bg_color = GColorWhite,
.bg_color = system_theme_get_bg_color(),
.num_zones = card_data->num_zones,
.zones = card_data->zones,
.data = card_data,
Expand Down
16 changes: 5 additions & 11 deletions src/fw/apps/system/launcher/default/app_glance_structured.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "resource/resource_ids.auto.h"
#include "pbl/services/timeline/attribute.h"
#include "shell/prefs.h"
#include "shell/system_theme.h"
#include "system/passert.h"
#include "util/attributes.h"
#include "util/string.h"
Expand Down Expand Up @@ -87,16 +88,9 @@ static void prv_structured_glance_icon_bitmap_processor_post_func(

GColor launcher_app_glance_structured_get_highlight_color(
LauncherAppGlanceStructured *structured_glance) {
#if PBL_COLOR
if (structured_glance->glance.is_highlighted) {
GColor highlight_bg = shell_prefs_get_theme_highlight_color();
return gcolor_legible_over(highlight_bg);
} else {
return GColorBlack;
}
#else
return structured_glance->glance.is_highlighted ? GColorWhite : GColorBlack;
#endif
return structured_glance->glance.is_highlighted ?
gcolor_legible_over(shell_prefs_get_theme_highlight_color()) :
system_theme_get_fg_color();
}

static GColor prv_get_icon_tint_color(LauncherAppGlanceStructured *structured_glance) {
Expand Down Expand Up @@ -362,7 +356,7 @@ static GTextNode *prv_create_structured_glance_title_subtitle_node(
GTextNode *title_node = prv_structured_glance_create_title_text_node(structured_glance);
// We require a valid title node
PBL_ASSERTN(title_node);

// Push the margin a bit closer
#if PBL_DISPLAY_HEIGHT >= 200 && PBL_RECT
title_node->margin.h = -3;
Expand Down
16 changes: 10 additions & 6 deletions src/fw/apps/system/music.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,9 @@ static void prv_no_music_window_click_config(void *context) {
static MusicNoMusicWindow *prv_create_no_music_window(void) {
MusicNoMusicWindow *window = app_malloc_check(sizeof(MusicNoMusicWindow));
window_init(&window->window, WINDOW_NAME("NoMusicWindow"));
window_set_background_color(&window->window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite));
window_set_background_color(&window->window, PBL_IF_COLOR_ELSE(
system_theme_is_dark_mode() ? GColorDarkGray : GColorLightGray,
GColorWhite));
window_set_window_handlers(&window->window, &(WindowHandlers) {
.unload = prv_unload_no_music_window
});
Expand All @@ -713,7 +715,7 @@ static MusicNoMusicWindow *prv_create_no_music_window(void) {
&NO_MUSIC_TEXT_RECT,
i18n_get("START PLAYBACK\nON YOUR PHONE", window),
fonts_get_system_font(config->no_music_font_key),
GColorBlack, GColorClear, GTextAlignmentCenter,
system_theme_get_fg_color(), GColorClear, GTextAlignmentCenter,
GTextOverflowModeTrailingEllipsis);
layer_add_child(&window->window.layer, &window->bitmap_layer.layer);
layer_add_child(&window->window.layer, &window->text_layer.layer);
Expand Down Expand Up @@ -834,15 +836,17 @@ static void prv_configure_music_text_layer(
TextLayer *text_layer, char* text_buffer, const GRect *rect, int16_t y_offset,
GTextAlignment align, GFont font) {
text_layer_init_with_parameters(text_layer, rect, text_buffer, font,
GColorBlack, GColorClear, align, GTextOverflowModeFill);
system_theme_get_fg_color(), GColorClear, align, GTextOverflowModeFill);
layer_set_bounds(&text_layer->layer, &GRect(0, -y_offset,
rect->size.w, rect->size.h + y_offset));
}

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

window_set_background_color(window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite));
window_set_background_color(window, PBL_IF_COLOR_ELSE(
system_theme_is_dark_mode() ? GColorDarkGray : GColorLightGray,
GColorWhite));

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

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

progress_layer_init(&data->track_pos_bar, &track_rect);
progress_layer_set_background_color(&data->track_pos_bar,
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
PBL_IF_COLOR_ELSE(system_theme_get_bg_color(), GColorWhite));
progress_layer_set_foreground_color(&data->track_pos_bar,
PBL_IF_COLOR_ELSE(GColorRed, GColorBlack));
progress_layer_set_corner_radius(&data->track_pos_bar, config->track_corner_radius);
Expand All @@ -915,7 +919,7 @@ static void prv_init_ui(Window *window) {
WINDOW_SIZE.w);
status_layer_frame.size.w = STATUS_BAR_LAYER_WIDTH;
layer_set_frame(&status_layer->layer, &status_layer_frame);
status_bar_layer_set_colors(&data->status_layer, GColorClear, GColorBlack);
status_bar_layer_set_colors(&data->status_layer, GColorClear, system_theme_get_fg_color());
layer_add_child(&data->window.layer, &status_layer->layer);

music_get_pos(&data->track_pos, &data->track_length);
Expand Down
12 changes: 6 additions & 6 deletions src/fw/apps/system/notifications.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,10 +711,10 @@ static void prv_window_load(Window *window) {
.select_click = prv_select_callback,
});

menu_layer_set_normal_colors(menu_layer, GColorWhite, GColorBlack);
menu_layer_set_normal_colors(menu_layer, system_theme_get_bg_color(), system_theme_get_fg_color());
menu_layer_set_highlight_colors(menu_layer,
PBL_IF_COLOR_ELSE(DEFAULT_NOTIFICATION_COLOR, GColorBlack),
GColorWhite);
PBL_IF_COLOR_ELSE(DEFAULT_NOTIFICATION_COLOR, system_theme_get_fg_color()),
system_theme_get_bg_color());

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

#if PBL_ROUND
GColor bg_color = GColorClear;
GColor fg_color = GColorBlack;
GColor fg_color = system_theme_get_fg_color();

StatusBarLayer *status_bar = &data->status_bar_layer;
status_bar_layer_init(status_bar);
Expand Down
3 changes: 0 additions & 3 deletions src/fw/apps/system/settings/activity_tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,6 @@ static Window *prv_init(void) {
option_menu_init(&data->option_menu);
// Not using option_menu_configure because prv_reload_menu_data already sets
// icons_enabled and chosen row index
option_menu_set_status_colors(&data->option_menu, GColorWhite, GColorBlack);
GColor highlight_bg = shell_prefs_get_theme_highlight_color();
option_menu_set_highlight_colors(&data->option_menu, highlight_bg, gcolor_legible_over(highlight_bg));
option_menu_set_title(&data->option_menu, i18n_get("Background App", data));
option_menu_set_content_type(&data->option_menu, OptionMenuContentType_SingleLine);
option_menu_set_callbacks(&data->option_menu, &option_menu_callbacks, data);
Expand Down
22 changes: 22 additions & 0 deletions src/fw/apps/system/settings/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ enum SettingsDisplayItem {
#endif
#if CAPABILITY_HAS_APP_SCALING
SettingsDisplayLegacyAppMode,
#endif
#if !CAPABILITY_HAS_THEMING
SettingsDisplayDarkMode,
#endif
NumSettingsDisplayItems
};
Expand Down Expand Up @@ -486,6 +489,11 @@ static void prv_display_select_click_cb(SettingsCallbacks *context, uint16_t row
case SettingsDisplayLegacyAppMode:
prv_legacy_app_mode_menu_push((SettingsDisplayData*)context);
break;
#endif
#if !CAPABILITY_HAS_THEMING
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CAPABILITY_HAS_THEMING hides a primitive theming system which this PR seems to improve, can we remove flag entirely, remove dead code and just offer this feature by default?

Copy link
Copy Markdown
Author

@amcolash amcolash Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On all color systems, yes. However, maybe we still need the flag for B/W watches? I suppose there could always be the themes menu and optionally have the "accent color" option on color-only devices.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#if PBL_BW or #if !PBL_COLOR

case SettingsDisplayDarkMode:
shell_prefs_set_dark_mode((shell_prefs_get_dark_mode() + 1) % DarkModeCount);
break;
#endif
default:
WTF;
Expand Down Expand Up @@ -530,6 +538,20 @@ static void prv_display_draw_row_cb(SettingsCallbacks *context, GContext *ctx,
subtitle = (shell_prefs_get_legacy_app_render_mode() >= LegacyAppRenderMode_ScalingNearest) ?
i18n_noop("Scaled") : i18n_noop("Centered");
break;
#endif
#if !CAPABILITY_HAS_THEMING
case SettingsDisplayDarkMode: {
title = i18n_noop("Dark Mode");
static const char * const s_dark_mode_labels[] = {
[DarkModeOff] = i18n_noop("Off"),
[DarkModeOn] = i18n_noop("On"),
#if CAPABILITY_HAS_AMBIENT_LIGHT_SENSOR
[DarkModeAuto] = i18n_noop("Auto"),
#endif
};
subtitle = s_dark_mode_labels[shell_prefs_get_dark_mode()];
break;
}
#endif
default:
WTF;
Expand Down
Loading
Loading