Skip to content

Commit

Permalink
Merge v1.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrossman committed Nov 12, 2020
2 parents 971eef3 + 08421e0 commit 7d09f38
Show file tree
Hide file tree
Showing 4 changed files with 33 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.17.0",
"version": "1.18.0",
"keywords": [
"pebble-app"
],
Expand Down
14 changes: 13 additions & 1 deletion src/c/appendix/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,16 @@ GFont config_time_font() {
};
int16_t font_index = g_config->time_font;
return fonts_get_system_font(font_keys[font_index]);
}
}

bool config_highlight_holidays() {
return !gcolor_equal(g_config->color_us_federal, GColorWhite);
}

bool config_highlight_sundays() {
return !gcolor_equal(g_config->color_sunday, GColorWhite);
}

bool config_highlight_saturdays() {
return !gcolor_equal(g_config->color_saturday, GColorWhite);
}
6 changes: 6 additions & 0 deletions src/c/appendix/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ int config_axis_hour(int hour);
int config_n_today();

GFont config_time_font();

bool config_highlight_holidays();

bool config_highlight_sundays();

bool config_highlight_saturdays();
19 changes: 13 additions & 6 deletions src/c/layers/calendar_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,25 @@ void calendar_layer_refresh() {
for (int i = 0; i < NUM_WEEKS * DAYS_PER_WEEK; ++i) {
char *buffer = s_calendar_box_buffers[i];
struct tm *t = relative_tm(i - i_today);

// Set the text color
if (i == i_today) {
text_layer_set_text_color(s_calendar_text_layers[i],
gcolor_legible_over(today_color()));
text_layer_set_font(s_calendar_text_layers[i],
fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
GColor text_color = gcolor_legible_over(today_color());
text_layer_set_text_color(s_calendar_text_layers[i], text_color);
}
else {
GColor text_color = PBL_IF_COLOR_ELSE(date_color(t), GColorWhite);
text_layer_set_text_color(s_calendar_text_layers[i], text_color);
text_layer_set_font(s_calendar_text_layers[i],
fonts_get_system_font(FONT_KEY_GOTHIC_18));
}

// Use bold font for today, and holidays/weekends if colored
bool highlight_holiday = (config_highlight_holidays() && is_us_federal_holiday(t));
bool highlight_sunday = (config_highlight_sundays() && t->tm_wday == 0);
bool highlight_saturday = (config_highlight_saturdays() && t->tm_wday == 6);
bool bold = (i == i_today) || highlight_holiday || highlight_sunday || highlight_saturday;
text_layer_set_font(s_calendar_text_layers[i],
fonts_get_system_font(bold ? FONT_KEY_GOTHIC_18_BOLD : FONT_KEY_GOTHIC_18));

snprintf(buffer, 4, "%d", t->tm_mday);
text_layer_set_text(s_calendar_text_layers[i], buffer);
}
Expand Down

0 comments on commit 7d09f38

Please sign in to comment.