Skip to content

Commit

Permalink
Add mushroom color option = icon_color
Browse files Browse the repository at this point in the history
rianadon committed Jul 21, 2023
1 parent bd1bf02 commit d00d5be
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/timer-bar-entity-row.ts
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ export class TimerBarEntityRow extends LitElement {
}
}

private _mode(): Mode {
protected _mode(): Mode {
return findMode(this.hass!, this.config, this._browserClockCorrection);
}

5 changes: 3 additions & 2 deletions src/timer-bar-mushroom-row.ts
Original file line number Diff line number Diff line change
@@ -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);`;
}
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -90,6 +90,7 @@ export interface TimerBarConfig extends TimerBarEntityConfig {
}

export interface Mushroom {
color?: string;
icon_color?: string;
layout?: string;
fill_container?: string;

0 comments on commit d00d5be

Please sign in to comment.