Make bar fill color configurable

This commit is contained in:
2026-06-28 12:21:59 -04:00
parent 601688d89d
commit ba617d7927
5 changed files with 35 additions and 16 deletions
+1
View File
@@ -37,6 +37,7 @@
"CLAY_COLOR_LED", "CLAY_COLOR_LED",
"CLAY_COLOR_BG", "CLAY_COLOR_BG",
"CLAY_COLOR_BAR_MG", "CLAY_COLOR_BAR_MG",
"CLAY_COLOR_BAR_FILL",
"CLAY_COLOR_BAR_COOL", "CLAY_COLOR_BAR_COOL",
"CLAY_COLOR_BAR_HOT", "CLAY_COLOR_BAR_HOT",
"CLAY_COLOR_TIME_MG", "CLAY_COLOR_TIME_MG",
+10 -5
View File
@@ -117,7 +117,7 @@ static void batt_callback(BatteryChargeState state) {
} }
static void temp_update_proc(Layer *layer, GContext *ctx) { static void temp_update_proc(Layer *layer, GContext *ctx) {
graphics_context_set_fill_color(ctx, GColorWhite); graphics_context_set_fill_color(ctx, settings.ColorBarsFill);
const uint8_t bar_count = s_temp_level; const uint8_t bar_count = s_temp_level;
uint16_t bar_bottom_pos = 195; uint16_t bar_bottom_pos = 195;
@@ -128,7 +128,7 @@ static void temp_update_proc(Layer *layer, GContext *ctx) {
} }
static void fuel_update_proc(Layer *layer, GContext *ctx) { static void fuel_update_proc(Layer *layer, GContext *ctx) {
graphics_context_set_fill_color(ctx, GColorWhite); graphics_context_set_fill_color(ctx, settings.ColorBarsFill);
uint16_t bar_bottom_pos = 195; uint16_t bar_bottom_pos = 195;
for (uint8_t i = 0; i < s_batt_level; ++i) { for (uint8_t i = 0; i < s_batt_level; ++i) {
@@ -139,7 +139,7 @@ static void fuel_update_proc(Layer *layer, GContext *ctx) {
static void temp_fuel_mg_update_proc_helper(Layer *layer, GContext *ctx, bool isFuel) { static void temp_fuel_mg_update_proc_helper(Layer *layer, GContext *ctx, bool isFuel) {
GRect bounds = layer_get_bounds(layer); GRect bounds = layer_get_bounds(layer);
graphics_context_set_fill_color(ctx, settings.ColorMGBars); graphics_context_set_fill_color(ctx, settings.ColorBarsMG);
graphics_fill_rect(ctx, bounds, 0, GCornerNone); graphics_fill_rect(ctx, bounds, 0, GCornerNone);
if (isFuel) { if (isFuel) {
graphics_context_set_stroke_color(ctx, settings.ColorBarsHot); graphics_context_set_stroke_color(ctx, settings.ColorBarsHot);
@@ -598,6 +598,7 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
Tuple *color_led_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_LED); Tuple *color_led_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_LED);
Tuple *color_bg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BG); Tuple *color_bg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BG);
Tuple *color_bar_mg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_MG); Tuple *color_bar_mg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_MG);
Tuple *color_bar_fill_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_FILL);
Tuple *color_bar_cool_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_COOL); Tuple *color_bar_cool_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_COOL);
Tuple *color_bar_hot_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_HOT); Tuple *color_bar_hot_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_BAR_HOT);
Tuple *color_time_mg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_TIME_MG); Tuple *color_time_mg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_COLOR_TIME_MG);
@@ -630,7 +631,10 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
settings.ColorBG = GColorFromHEX(color_bg_tuple->value->int32); settings.ColorBG = GColorFromHEX(color_bg_tuple->value->int32);
} }
if (color_bar_mg_tuple) { if (color_bar_mg_tuple) {
settings.ColorMGBars = GColorFromHEX(color_bar_mg_tuple->value->int32); settings.ColorBarsMG = GColorFromHEX(color_bar_mg_tuple->value->int32);
}
if (color_bar_fill_tuple) {
settings.ColorBarsFill = GColorFromHEX(color_bar_fill_tuple->value->int32);
} }
if (color_bar_cool_tuple) { if (color_bar_cool_tuple) {
settings.ColorBarsCool = GColorFromHEX(color_bar_cool_tuple->value->int32); settings.ColorBarsCool = GColorFromHEX(color_bar_cool_tuple->value->int32);
@@ -670,7 +674,8 @@ static void init() {
settings.LowFuelPercent = 20; settings.LowFuelPercent = 20;
settings.ColorLED = GColorWhite; settings.ColorLED = GColorWhite;
settings.ColorBG = GColorBlue; settings.ColorBG = GColorBlue;
settings.ColorMGBars = GColorDarkGray; settings.ColorBarsMG = GColorDarkGray;
settings.ColorBarsFill = GColorWhite;
settings.ColorBarsCool = GColorDukeBlue; settings.ColorBarsCool = GColorDukeBlue;
settings.ColorBarsHot = GColorRed; settings.ColorBarsHot = GColorRed;
settings.ColorMGTime = GColorDarkGray; settings.ColorMGTime = GColorDarkGray;
+2 -1
View File
@@ -12,7 +12,8 @@ typedef struct ClaySettings {
bool UseCustomLED; bool UseCustomLED;
GColor ColorLED; GColor ColorLED;
GColor ColorBG; GColor ColorBG;
GColor ColorMGBars; GColor ColorBarsMG;
GColor ColorBarsFill;
GColor ColorBarsCool; GColor ColorBarsCool;
GColor ColorBarsHot; GColor ColorBarsHot;
GColor ColorMGTime; GColor ColorMGTime;
+17 -9
View File
@@ -119,7 +119,7 @@ module.exports = [
"messageKey": "CLAY_COLOR_BG", "messageKey": "CLAY_COLOR_BG",
"defaultValue": "0000ff", "defaultValue": "0000ff",
"label": "Background color", "label": "Background color",
"sunlight": false, "sunlight": true,
}, },
{ {
"id": "custom_color_mg_bars", "id": "custom_color_mg_bars",
@@ -127,7 +127,15 @@ module.exports = [
"messageKey": "CLAY_COLOR_BAR_MG", "messageKey": "CLAY_COLOR_BAR_MG",
"defaultValue": "aaaaaa", "defaultValue": "aaaaaa",
"label": "Bar midground color", "label": "Bar midground color",
"sunlight": false, "sunlight": true,
},
{
"id": "custom_color_fill_bars",
"type": "color",
"messageKey": "CLAY_COLOR_BAR_FILL",
"defaultValue": "ffffff",
"label": "Bar fill color",
"sunlight": true,
}, },
{ {
"id": "custom_color_cool_bars", "id": "custom_color_cool_bars",
@@ -135,7 +143,7 @@ module.exports = [
"messageKey": "CLAY_COLOR_BAR_COOL", "messageKey": "CLAY_COLOR_BAR_COOL",
"defaultValue": "0000aa", "defaultValue": "0000aa",
"label": "Bar cold/full color", "label": "Bar cold/full color",
"sunlight": false, "sunlight": true,
}, },
{ {
"id": "custom_color_hot_bars", "id": "custom_color_hot_bars",
@@ -143,7 +151,7 @@ module.exports = [
"messageKey": "CLAY_COLOR_BAR_HOT", "messageKey": "CLAY_COLOR_BAR_HOT",
"defaultValue": "ff0000", "defaultValue": "ff0000",
"label": "Bar hot/empty color", "label": "Bar hot/empty color",
"sunlight": false, "sunlight": true,
}, },
{ {
"id": "custom_color_mg_time", "id": "custom_color_mg_time",
@@ -151,7 +159,7 @@ module.exports = [
"messageKey": "CLAY_COLOR_TIME_MG", "messageKey": "CLAY_COLOR_TIME_MG",
"defaultValue": "555555", "defaultValue": "555555",
"label": "Time segment midground color", "label": "Time segment midground color",
"sunlight": false, "sunlight": true,
}, },
{ {
"id": "custom_color_letters", "id": "custom_color_letters",
@@ -159,7 +167,7 @@ module.exports = [
"messageKey": "CLAY_COLOR_LETTERS", "messageKey": "CLAY_COLOR_LETTERS",
"defaultValue": "ffffff", "defaultValue": "ffffff",
"label": "Letters (C/H/E/F) color", "label": "Letters (C/H/E/F) color",
"sunlight": false, "sunlight": true,
}, },
{ {
"id": "custom_color_hours", "id": "custom_color_hours",
@@ -167,7 +175,7 @@ module.exports = [
"messageKey": "CLAY_COLOR_HOURS", "messageKey": "CLAY_COLOR_HOURS",
"defaultValue": "ffffff", "defaultValue": "ffffff",
"label": "Hours color", "label": "Hours color",
"sunlight": false, "sunlight": true,
}, },
{ {
"id": "custom_color_minutes", "id": "custom_color_minutes",
@@ -175,7 +183,7 @@ module.exports = [
"messageKey": "CLAY_COLOR_MINUTES", "messageKey": "CLAY_COLOR_MINUTES",
"defaultValue": "ffffff", "defaultValue": "ffffff",
"label": "Minutes color", "label": "Minutes color",
"sunlight": false, "sunlight": true,
}, },
{ {
"id": "custom_color_warning", "id": "custom_color_warning",
@@ -183,7 +191,7 @@ module.exports = [
"messageKey": "CLAY_COLOR_WARNING", "messageKey": "CLAY_COLOR_WARNING",
"defaultValue": "ffaa00", "defaultValue": "ffaa00",
"label": "Warning indicator color", "label": "Warning indicator color",
"sunlight": false, "sunlight": true,
} }
] ]
}, },
+5 -1
View File
@@ -21,10 +21,11 @@ module.exports = function (minified) {
clayConfig.getItemById('custom_color_bg').set('000000'); clayConfig.getItemById('custom_color_bg').set('000000');
clayConfig.getItemById('custom_color_mg_bars').set('555555'); clayConfig.getItemById('custom_color_mg_bars').set('555555');
clayConfig.getItemById('custom_color_fill_bars').set('ffffff');
clayConfig.getItemById('custom_color_cool_bars').set('0000aa'); clayConfig.getItemById('custom_color_cool_bars').set('0000aa');
clayConfig.getItemById('custom_color_hot_bars').set('ff0000'); clayConfig.getItemById('custom_color_hot_bars').set('ff0000');
clayConfig.getItemById('custom_color_mg_time').set('555555'); clayConfig.getItemById('custom_color_mg_time').set('555555');
clayConfig.getItemById('custom_color_letters').set('ff0000'); clayConfig.getItemById('custom_color_letters').set('ffffff');
clayConfig.getItemById('custom_color_hours').set('ff0000'); clayConfig.getItemById('custom_color_hours').set('ff0000');
clayConfig.getItemById('custom_color_minutes').set('ff0000'); clayConfig.getItemById('custom_color_minutes').set('ff0000');
clayConfig.getItemById('custom_color_warning').set('ffaa00'); clayConfig.getItemById('custom_color_warning').set('ffaa00');
@@ -34,6 +35,7 @@ module.exports = function (minified) {
clayConfig.getItemById('custom_color_bg').set('0000ff'); clayConfig.getItemById('custom_color_bg').set('0000ff');
clayConfig.getItemById('custom_color_mg_bars').set('555555'); clayConfig.getItemById('custom_color_mg_bars').set('555555');
clayConfig.getItemById('custom_color_fill_bars').set('ffffff');
clayConfig.getItemById('custom_color_cool_bars').set('0000aa'); clayConfig.getItemById('custom_color_cool_bars').set('0000aa');
clayConfig.getItemById('custom_color_hot_bars').set('ff0000'); clayConfig.getItemById('custom_color_hot_bars').set('ff0000');
clayConfig.getItemById('custom_color_mg_time').set('555555'); clayConfig.getItemById('custom_color_mg_time').set('555555');
@@ -51,6 +53,7 @@ module.exports = function (minified) {
clayConfig.getItemById('custom_color_led').show(); clayConfig.getItemById('custom_color_led').show();
clayConfig.getItemById('custom_color_bg').show(); clayConfig.getItemById('custom_color_bg').show();
clayConfig.getItemById('custom_color_mg_bars').show(); clayConfig.getItemById('custom_color_mg_bars').show();
clayConfig.getItemById('custom_color_fill_bars').show();
clayConfig.getItemById('custom_color_cool_bars').show(); clayConfig.getItemById('custom_color_cool_bars').show();
clayConfig.getItemById('custom_color_hot_bars').show(); clayConfig.getItemById('custom_color_hot_bars').show();
clayConfig.getItemById('custom_color_mg_time').show(); clayConfig.getItemById('custom_color_mg_time').show();
@@ -65,6 +68,7 @@ module.exports = function (minified) {
clayConfig.getItemById('custom_color_led').hide(); clayConfig.getItemById('custom_color_led').hide();
clayConfig.getItemById('custom_color_bg').hide(); clayConfig.getItemById('custom_color_bg').hide();
clayConfig.getItemById('custom_color_mg_bars').hide(); clayConfig.getItemById('custom_color_mg_bars').hide();
clayConfig.getItemById('custom_color_fill_bars').hide();
clayConfig.getItemById('custom_color_cool_bars').hide(); clayConfig.getItemById('custom_color_cool_bars').hide();
clayConfig.getItemById('custom_color_hot_bars').hide(); clayConfig.getItemById('custom_color_hot_bars').hide();
clayConfig.getItemById('custom_color_mg_time').hide(); clayConfig.getItemById('custom_color_mg_time').hide();