From d00d5be18839825212bb9969f1c314da8b513fb7 Mon Sep 17 00:00:00 2001 From: Ryan Adolf Date: Fri, 21 Jul 2023 13:17:59 -0700 Subject: [PATCH] Add mushroom color option = icon_color --- src/timer-bar-entity-row.ts | 2 +- src/timer-bar-mushroom-row.ts | 5 +++-- src/types.ts | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/timer-bar-entity-row.ts b/src/timer-bar-entity-row.ts index ede1adb..e33d05f 100644 --- a/src/timer-bar-entity-row.ts +++ b/src/timer-bar-entity-row.ts @@ -90,7 +90,7 @@ export class TimerBarEntityRow extends LitElement { } } - private _mode(): Mode { + protected _mode(): Mode { return findMode(this.hass!, this.config, this._browserClockCorrection); } diff --git a/src/timer-bar-mushroom-row.ts b/src/timer-bar-mushroom-row.ts index 1da2a38..c6633bf 100644 --- a/src/timer-bar-mushroom-row.ts +++ b/src/timer-bar-mushroom-row.ts @@ -22,6 +22,7 @@ const computeDarkMode = (hass: HomeAssistant|undefined) => export function fillMushroomConfig(config: TimerBarEntityConfig, mushroom: Mushroom): TimerBarConfig { let color = 'var(--rgb-state-entity)' if (mushroom.icon_color) color = computeRgbColor(mushroom.icon_color) + if (mushroom.color) color = computeRgbColor(mushroom.color) return { ...fillConfig(config), bar_background: `rgba(${color}, 0.2)`, @@ -97,8 +98,8 @@ export class TimerBarMushroomRow extends TimerBarEntityRow { const icon = this.config.icon; const active = this._mode() == 'active' let style = '' - if (this.mushroom.icon_color) { - const iconRgbColor = computeRgbColor(this.mushroom.icon_color); + if (this.mushroom.icon_color || this.mushroom.color) { + const iconRgbColor = computeRgbColor(this.mushroom.color! || this.mushroom.icon_color!); style += `--icon-color:rgb(${iconRgbColor});`; style += `--shape-color:rgba(${iconRgbColor}, 0.2);`; } diff --git a/src/types.ts b/src/types.ts index f705fc4..42cfa68 100644 --- a/src/types.ts +++ b/src/types.ts @@ -90,6 +90,7 @@ export interface TimerBarConfig extends TimerBarEntityConfig { } export interface Mushroom { + color?: string; icon_color?: string; layout?: string; fill_container?: string;