Skip to content

Commit

Permalink
Merge v1.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrossman committed Nov 7, 2020
2 parents 1a81549 + 5994488 commit 971eef3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ForecasWatch 2",
"author": "Matt Rossman",
"version": "1.16.0",
"version": "1.17.0",
"keywords": [
"pebble-app"
],
Expand Down
2 changes: 1 addition & 1 deletion src/c/appendix/persist.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void persist_init() {
.start_mon = false,
.prev_week = true,
.time_font = 0,
.color_today = GColorWhite,
.color_today = GColorBlack,
.show_qt = true,
.show_bt = true,
.show_bt_disconnect = true,
Expand Down
16 changes: 11 additions & 5 deletions src/c/layers/calendar_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ static GColor date_color(struct tm *t) {
return GColorWhite;
}

static GColor today_color() {
// Either follow the date color or override to configured value
struct tm *t = relative_tm(0);
return PBL_IF_COLOR_ELSE(
gcolor_equal(g_config->color_today, GColorBlack) ? date_color(t) : g_config->color_today,
GColorWhite
);
}

static void calendar_update_proc(Layer *layer, GContext *ctx) {
GRect bounds = layer_get_bounds(layer);
int w = bounds.size.w;
Expand All @@ -92,10 +101,8 @@ static void calendar_update_proc(Layer *layer, GContext *ctx) {

// Calculate which box holds today's date
const int i_today = config_n_today();
struct tm *t = relative_tm(0);

GColor background_color = PBL_IF_COLOR_ELSE(date_color(t), GColorWhite);
graphics_context_set_fill_color(ctx, background_color);
graphics_context_set_fill_color(ctx, today_color());
graphics_fill_rect(ctx,
GRect((i_today % DAYS_PER_WEEK) * box_w, (i_today / DAYS_PER_WEEK) * box_h,
box_w, box_h), 1, GCornersAll);
Expand Down Expand Up @@ -138,9 +145,8 @@ void calendar_layer_refresh() {
char *buffer = s_calendar_box_buffers[i];
struct tm *t = relative_tm(i - i_today);
if (i == i_today) {
GColor background_color = PBL_IF_COLOR_ELSE(date_color(t), GColorWhite);
text_layer_set_text_color(s_calendar_text_layers[i],
gcolor_legible_over(background_color));
gcolor_legible_over(today_color()));
text_layer_set_font(s_calendar_text_layers[i],
fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
}
Expand Down
4 changes: 3 additions & 1 deletion src/pkjs/clay/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ module.exports = [
"type": "color",
"label": "Today highlight",
"messageKey": "colorToday",
"defaultValue": "#FFFFFF",
"defaultValue": "#000000",
"description": "Black (default) means match date color, any other value overrides this.",
"sunlight": false,
"capabilities": ["COLOR"]
},
Expand All @@ -140,6 +141,7 @@ module.exports = [
"label": "US federal holidays color",
"messageKey": "colorUSFederal",
"defaultValue": "#FFFFFF",
"description": "White (default) means disable",
"sunlight": false,
"capabilities": ["COLOR"]
},
Expand Down

0 comments on commit 971eef3

Please sign in to comment.