From d113d44d5a128efca3ba79eeb45699fd101332de Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 2 Mar 2023 14:37:26 +0100 Subject: [PATCH] Use state color for on and off in more info (#15677) --- .../more-info/components/ha-more-info-toggle.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/dialogs/more-info/components/ha-more-info-toggle.ts b/src/dialogs/more-info/components/ha-more-info-toggle.ts index 0548a45e9a..00a3d483cf 100644 --- a/src/dialogs/more-info/components/ha-more-info-toggle.ts +++ b/src/dialogs/more-info/components/ha-more-info-toggle.ts @@ -64,7 +64,9 @@ export class HaMoreInfoToggle extends LitElement { } protected render(): TemplateResult { - const color = stateColorCss(this.stateObj); + const onColor = stateColorCss(this.stateObj, "on"); + const offColor = stateColorCss(this.stateObj, "off"); + const isOn = this.stateObj.state === "on"; const isOff = this.stateObj.state === "off"; @@ -82,7 +84,7 @@ export class HaMoreInfoToggle extends LitElement { active: isOn, })} style=${styleMap({ - "--color": color, + "--color": onColor, })} > @@ -97,7 +99,7 @@ export class HaMoreInfoToggle extends LitElement { active: isOff, })} style=${styleMap({ - "--color": color, + "--color": offColor, })} > @@ -117,7 +119,8 @@ export class HaMoreInfoToggle extends LitElement { @change=${this._valueChanged} .ariaLabel=${this.hass.localize("ui.dialogs.more_info_control.toggle")} style=${styleMap({ - "--control-switch-on-color": color, + "--control-switch-on-color": onColor, + "--control-switch-off-color": offColor, })} .disabled=${this.stateObj.state === UNAVAILABLE} >