mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 13:27:22 +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
|
||||
? Math.round((stateObj.attributes.rgbww_color[4] * 100) / 255)
|
||||
: undefined;
|
||||
this._colorBrightnessSliderValue = Math.round(
|
||||
(Math.max(...getLightCurrentModeRgbColor(stateObj).slice(0, 3)) * 100) /
|
||||
255
|
||||
);
|
||||
|
||||
this._colorPickerColor = getLightCurrentModeRgbColor(stateObj).slice(
|
||||
0,
|
||||
3
|
||||
) as [number, number, number];
|
||||
const currentRgbColor = getLightCurrentModeRgbColor(stateObj);
|
||||
|
||||
this._colorBrightnessSliderValue = currentRgbColor
|
||||
? Math.round((Math.max(...currentRgbColor.slice(0, 3)) * 100) / 255)
|
||||
: undefined;
|
||||
|
||||
this._colorPickerColor = currentRgbColor?.slice(0, 3) as [
|
||||
number,
|
||||
number,
|
||||
number
|
||||
];
|
||||
} else {
|
||||
this._brightnessSliderValue = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user