diff --git a/public/static/images/color_wheel.png b/public/static/images/color_wheel.png new file mode 100644 index 0000000000..62b9e48ce8 Binary files /dev/null and b/public/static/images/color_wheel.png differ diff --git a/src/data/light.ts b/src/data/light.ts index 4e86d54f9d..2114d91bef 100644 --- a/src/data/light.ts +++ b/src/data/light.ts @@ -50,7 +50,7 @@ export const lightIsInColorMode = (entity: LightEntity) => export const lightSupportsColor = (entity: LightEntity) => entity.attributes.supported_color_modes?.some((mode) => modesSupportingColor.includes(mode) - ); + ) || false; export const lightSupportsBrightness = (entity: LightEntity) => entity.attributes.supported_color_modes?.some((mode) => diff --git a/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts b/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts index f1db76a7a4..abb08b7e0e 100644 --- a/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts +++ b/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts @@ -97,6 +97,7 @@ class MoreInfoAlarmControlPanel extends LitElement { md-outlined-button { --ha-icon-display: block; --md-sys-color-primary: var(--primary-text-color); + --md-sys-color-outline: var(--divider-color); } @keyframes pulse { 0% { diff --git a/src/dialogs/more-info/controls/more-info-fan.ts b/src/dialogs/more-info/controls/more-info-fan.ts index cda083d179..bbbc1f5d36 100644 --- a/src/dialogs/more-info/controls/more-info-fan.ts +++ b/src/dialogs/more-info/controls/more-info-fan.ts @@ -334,6 +334,7 @@ class MoreInfoFan extends LitElement { md-outlined-button { --ha-icon-display: block; --md-sys-color-primary: var(--primary-text-color); + --md-sys-color-outline: var(--divider-color); } `, ]; diff --git a/src/dialogs/more-info/controls/more-info-light.ts b/src/dialogs/more-info/controls/more-info-light.ts index 3bcfb9fced..c9c9d90944 100644 --- a/src/dialogs/more-info/controls/more-info-light.ts +++ b/src/dialogs/more-info/controls/more-info-light.ts @@ -1,11 +1,11 @@ import "@material/mwc-list/mwc-list-item"; +import "@material/web/button/outlined-button"; import "@material/web/iconbutton/outlined-icon-button"; import { mdiCreation, mdiFileWordBox, mdiLightbulb, mdiLightbulbOff, - mdiPalette, mdiPower, } from "@mdi/js"; import { @@ -17,7 +17,9 @@ import { PropertyValues, } from "lit"; import { customElement, property, state } from "lit/decorators"; +import { classMap } from "lit/directives/class-map"; import { stopPropagation } from "../../../common/dom/stop_propagation"; +import { computeAttributeNameDisplay } from "../../../common/entity/compute_attribute_display"; import { supportsFeature } from "../../../common/entity/supports-feature"; import { blankBeforePercent } from "../../../common/translations/blank_before_percent"; import "../../../components/ha-attributes"; @@ -46,6 +48,8 @@ class MoreInfoLight extends LitElement { @property({ attribute: false }) public stateObj?: LightEntity; + @state() private _effect?: string; + @state() private _selectedBrightness?: number; private _brightnessChanged(ev) { @@ -59,6 +63,7 @@ class MoreInfoLight extends LitElement { this._selectedBrightness = this.stateObj?.attributes.brightness ? Math.round((this.stateObj.attributes.brightness * 100) / 255) : undefined; + this._effect = this.stateObj?.attributes.effect; } } @@ -141,6 +146,10 @@ class MoreInfoLight extends LitElement { ${supportsColorTemp || supportsColor ? html` - ` : nothing} @@ -170,43 +178,43 @@ class MoreInfoLight extends LitElement { ` : nothing} - ${supportsEffects && this.stateObj.attributes.effect_list - ? html` - - - - - ${this.stateObj.attributes.effect_list.map( - (effect: string) => html` - - ${effect} - - ` - )} - - ` - : nothing} ` : nothing} + ${supportsEffects && this.stateObj.attributes.effect_list + ? html` + + + + ${this._effect || + computeAttributeNameDisplay( + this.hass.localize, + this.stateObj, + this.hass.entities, + "effect" + )} + + ${this.stateObj.attributes.effect_list.map( + (effect: string) => html` + + ${effect} + + ` + )} + + ` + : nothing}