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 <pbl/logging/logging.h>
#include "system/passert.h"
Expand Down Expand Up @@ -787,8 +788,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 @@ -1531,7 +1533,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 @@ -9,6 +9,7 @@
#include "kernel/ui/kernel_ui.h"
#include "kernel/ui/system_icons.h"
#include "pbl/util/size.h"
#include "shell/system_theme.h"

#include <stdio.h>
#include <limits.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 @@ -8,6 +8,7 @@
#include "applib/graphics/graphics.h"
#include "applib/ui/layer.h"
#include "pbl/util/math.h"
#include "shell/system_theme.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 @@ -137,8 +138,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 @@ -20,6 +20,7 @@
#include "process_management/process_manager.h"
#include "process_state/app_state/app_state.h"
#include <pbl/logging/logging.h>
#include "shell/system_theme.h"
#include "system/passert.h"
#include "syscall/syscall.h"

Expand Down Expand Up @@ -90,8 +91,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 @@ -186,7 +187,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 @@ -360,7 +360,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 @@ -410,8 +410,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 @@ -17,6 +17,7 @@
#include "pbl/services/timeline/timeline.h"
#include "resource/resource_ids.auto.h"
#include <pbl/logging/logging.h>
#include "shell/system_theme.h"

// Health app versions
// 0: Invalid (app was never opened)
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
30 changes: 28 additions & 2 deletions src/fw/apps/system/health/hr_summary_card.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#define HEALTH_X_OFFSET ((DISP_COLS - LEGACY_2X_DISP_COLS) / 2)
#define HEALTH_Y_OFFSET ((DISP_ROWS - LEGACY_2X_DISP_ROWS) / 2)

#include "shell/system_theme.h"

typedef struct HealthHrSummaryCardData {
HealthData *health_data;
HealthProgressBar progress_bar;
Expand All @@ -44,8 +46,8 @@ typedef struct HealthHrSummaryCardData {
#define PROGRESS_BACKGROUND_COLOR (PBL_IF_COLOR_ELSE(GColorDarkCandyAppleRed, GColorBlack))
#define PROGRESS_OUTLINE_COLOR (PBL_IF_COLOR_ELSE(GColorClear, GColorBlack))

#define TEXT_COLOR (PBL_IF_COLOR_ELSE(GColorBulgarianRose, GColorBlack))
#define CARD_BACKGROUND_COLOR (PBL_IF_COLOR_ELSE(GColorWhite, GColorWhite))
#define TEXT_COLOR (PBL_IF_COLOR_ELSE(GColorBulgarianRose, system_theme_get_fg_color()))
#define CARD_BACKGROUND_COLOR (system_theme_get_bg_color())


static void prv_pulsing_heart_timer_cb(void *context) {
Expand Down Expand Up @@ -192,6 +194,19 @@ static void prv_hr_detail_card_unload_callback(Window *window) {
// API Functions
//

static bool prv_recolor_pulsing_heart_cb(GDrawCommand *command, uint32_t index, void *context) {
GColor stroke = gdraw_command_get_stroke_color(command);
GColor fill = gdraw_command_get_fill_color(command);

if (gcolor_equal(stroke, GColorBlack)) {
gdraw_command_set_stroke_color(command, GColorWhite);
}
if (gcolor_equal(fill, GColorWhite)) {
gdraw_command_set_fill_color(command, GColorClear);
}
return true;
}

Layer *health_hr_summary_card_create(HealthData *health_data) {
// create base layer
Layer *base_layer = layer_create_with_data(GRectZero, sizeof(HealthHrSummaryCardData));
Expand Down Expand Up @@ -219,6 +234,17 @@ Layer *health_hr_summary_card_create(HealthData *health_data) {
.timestamp_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD),
};

if (system_theme_is_dark_mode() && data->pulsing_heart) {
const uint32_t num_frames = gdraw_command_sequence_get_num_frames(data->pulsing_heart);
for (uint32_t i = 0; i < num_frames; i++) {
GDrawCommandFrame *f = gdraw_command_sequence_get_frame_by_index(data->pulsing_heart, i);
if (f) {
gdraw_command_list_iterate(gdraw_command_frame_get_command_list(f),
prv_recolor_pulsing_heart_cb, NULL);
}
}
}

data->pulsing_heart_timer = app_timer_register(0, prv_pulsing_heart_timer_cb, base_layer);

return base_layer;
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 "pbl/util/attributes.h"
#include "pbl/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 @@ -822,7 +822,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 @@ -845,7 +847,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 @@ -985,7 +987,7 @@ 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));
}
Expand Down Expand Up @@ -1418,7 +1420,9 @@ static void prv_apply_art_appearance(MusicAppData *data) {
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 @@ -1501,7 +1505,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 @@ -1520,7 +1524,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 @@ -714,10 +714,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 @@ -733,14 +733,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
Loading