mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-26 06:17:20 +00:00
Add guard for non color lights (#9186)
This commit is contained in:
parent
5abb3dd8c1
commit
4f731baa00
@ -282,15 +282,18 @@ class MoreInfoLight extends LitElement {
|
|||||||
stateObj.attributes.color_mode === LightColorModes.RGBWW
|
stateObj.attributes.color_mode === LightColorModes.RGBWW
|
||||||
? Math.round((stateObj.attributes.rgbww_color[4] * 100) / 255)
|
? Math.round((stateObj.attributes.rgbww_color[4] * 100) / 255)
|
||||||
: undefined;
|
: undefined;
|
||||||
this._colorBrightnessSliderValue = Math.round(
|
|
||||||
(Math.max(...getLightCurrentModeRgbColor(stateObj).slice(0, 3)) * 100) /
|
|
||||||
255
|
|
||||||
);
|
|
||||||
|
|
||||||
this._colorPickerColor = getLightCurrentModeRgbColor(stateObj).slice(
|
const currentRgbColor = getLightCurrentModeRgbColor(stateObj);
|
||||||
0,
|
|
||||||
3
|
this._colorBrightnessSliderValue = currentRgbColor
|
||||||
) as [number, number, number];
|
? Math.round((Math.max(...currentRgbColor.slice(0, 3)) * 100) / 255)
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
this._colorPickerColor = currentRgbColor?.slice(0, 3) as [
|
||||||
|
number,
|
||||||
|
number,
|
||||||
|
number
|
||||||
|
];
|
||||||
} else {
|
} else {
|
||||||
this._brightnessSliderValue = 0;
|
this._brightnessSliderValue = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user