frontend
frontend copied to clipboard
Color Temp should not change icon color
The problem
https://github.com/home-assistant/core/pull/55219
this PR forces color temp lights to report RGB values to change the color of the icon, breaking the aesthetics of most themes and leaving it almost impossible to distinguish between lights that are on vs off at a glance. As lights that are off are white and lights that cool white are also the same white.
What is version of Home Assistant Core has the issue?
core-2021.9.5
What was the last working version of Home Assistant Core?
core-2021.8.8
What type of installation are you running?
Home Assistant OS
Integration causing the issue
No response
Link to integration documentation on our website
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
Most themes, the off color of icons is white. So if lights are on cool white they are now also white and impossible to distinguish from off. And when on and warm white they have an orangy icon. These icons used to follow the current theme and only adjust based on brightness while maintaining the color of the theme.
here the Lamps are ON but cool white, the ceiling and closet are off. Previously they would have been the themes color for on, in this case yellow.
Top 3 are not color temp lights while the bottom 3 are, completely breaking the consistency of the theme and every other icon.
Different attributes when on vs off
Color temp bulbs are not RGB and the attribute shouldn't be forced onto the entities. This was a "bug" previously when lights were reporting incorrect supported features, https://github.com/home-assistant/core/issues/52661, and now it is baked in as an actual "feature".
light documentation light source (message by IssueLinks)
Same here my RGB lights show orange color icon when I request warm white, and when I swipe to cool white show rose icon color. ☹️
Mine is doing the same thing. has anyone found an answer yet? I did try to remove a device and pair it again but still the same thing!
This change wasn't the greatest idea - it makes it quite literally impossible to tell when a state icon light that is cool white is 'on' vs 'off'. Sure, the old default 'Yellow' didn't make a whole lot of sense for a cool whit light, but at least you could easily tell whether it was on of off....and it still changed colors if you changed a multicolor light to any other color.
Because there's no "perfect" scenario for this, this PR should definitely be reverted and left to the theming options as it was before - for individual customization. Also - having the theme control it fixes cool white light state icons now looking like they do nothing when turned on, vs all fan/smart outlet/etc. state icons still turning yellow as before. This just was not a very well thought out change. If not reverted entirely, at the very least a global override should be put in. Please!!
Yes, my cool white light icons can't be seen in lovelace... unless I use dark mode which is not what I'd like to do.
I'd say it is pretty much broken in this case and I had to revert to 2021.8 in the hope of this being rectified in the future.
In the meantime, I've hardcoded the color so that it shows the default yellow regardless of the color_temp... (while the brightness still changes the shade of the icon)
elif color_mode == COLOR_MODE_COLOR_TEMP and self.color_temp:
#hs_color = color_util.color_temperature_to_hs(
#color_util.color_temperature_mired_to_kelvin(self.color_temp)
#)
hs_color = (49, 98)
data[ATTR_HS_COLOR] = (round(hs_color[0], 3), round(hs_color[1], 3))
data[ATTR_RGB_COLOR] = color_util.color_hs_to_RGB(*hs_color)
data[ATTR_XY_COLOR] = color_util.color_hs_to_xy(*hs_color)
Not sure whats up with yours but mine show a pinkish color when they are on the coolest white. I actually really like the change.
Thanks. Your reply triggered further investigation, and what I have found is that the lights that supported max coolness of 5700K were fine (like yours, a faint pinkish/apricotish color, but other lights that supported up to 6500K completed disappeared.
Looking at this again, I am not sure if this is the same problem as OP and I apologise if it is not.
Rather than fixing the color per my workaround above, I tried the following workaround to make sure the icon display never goes beyond 5700K (without actually affecting the light itself), and it seems to be working ok (still a little too faint for my poor eyesight)... color_util.color_temperature_mired_to_kelvin(max(175,self.color_temp)) in place of: color_util.color_temperature_mired_to_kelvin(max(self.color_temp)
I believe the gen 3 Hue white & color ambience bulbs support up to 6500k, and that's what I had mine set to. It's difficult if not impossible to tell when they're on - certainly a poor user experience being unable to instantly at a glance tell when lights are on which really sucks.
@joe-sydney this is probably a stupid question but where are you making this color_util.color_temperature_mired_to_kelvin(max(175,self.color_temp) change? I have a generic "light reset" script I use to set all lights back to a default color/brightness when they get changed, but other than that all I'm really using are state icons on a Lovelace picture elements card so I'm not really sure where this would be changed at.
This line of code is in the actual light component itself and not a user configuration. I use venv virtual environment so the file I tweaked is here: /srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/light/init.py
Until something is done by the devs, I have had to make a change each time I upgrade homeassistant (as the change gets overridden). But I can't not do it, because the light icon either gets too faint or disappears all together.
Interesting...I'm currently using an HomeAssistant OS install. Wonder if I could potentially SSH into it and do a sudo nano update on that file. What a royal pain. ☹️
I'm shocked that apparently so few people use >5700k color temps with Lovelace state icons...or apparently just don't care about seeing whether their lights are on or not. Seems like this is a very flawed commit.
Does yours gradually disappear as you increase the coolness of your light beyond a certain level? On HA you can see what mired you're on. The 175 (mired) corresponds to 5700K, I believe... 1000000/color_temp_in_kelvins
I honestly haven't played with it that extensively, but I believe so. I usually have the color tone as cool as it will go...and the difference between the 'off' color vs the 'on' color at that color temp is incredibly hard to distinguish. Like almost hard enough that I have to already know a light is on in order to make out the most miniscule of color difference.
For now one of the things I did was changed my default light settings to technically be the lightest possible blue color (instead of straight white) since 6500k or whatever is already very cool in color it's not really noticable, but it changes the state icon color to a faint blue. The faint blue is still pretty difficult to see at a glance, but it's at least not practically impossible.
OK, that's why I am not sure you have the same problem as me because you said you can't tell the difference between on and off. Off was fine for me, but when it is on, the icon goes invisible when the light is changed to very cool as you can see from one of the pictures I included. Totally Gonesky.
I see. Yeah mine don't totally disappear like you've noted. They just functionally don't react to pressing the state-icon button because the state-icon button basically stays the exact same color.
I believe the theme I'm using is Midnight v2 from HACS, iirc. It's definitely not a light theme, buts it's far from a dark theme either. Not sure if that could make a difference or not.
Maybe have an "outline" setting that would show the same icon's outline in a fixed color. The outline color would need to be settable.
Potential implementation would be to have the same icon stacked just behind the colored icon, and scaled very slightly larger. Would certainly need to be sure to test with transforms of all types.
Could we get a simple bool setting like state_color
in the button card? I find it really annoying, I understand the need to distinguish lights ant the fact that changing its color in UI is te simplest solution but in the every day scenario my family found it confusing and started to ask me why the light in living room is pink and the one in garage is blue if they're both white, not RGB. Not to mention the temperature in which one of my lights go full white, which at first glance looks like a bug, not a feature.
Totally agree with @wojtek14a this should be optional and configurable using a boolean.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
This is still a problem, and an accessibility issue at that due to poor contrast. Here's a current example of some full-colour bulbs on "white":

I think adding an outline as suggested above would be a good way to fix this.
This type of issue has been around for as long as computer displays have existed. Surely there's a UI expert here who can suggest a tried and true design pattern.
While I'm not a designer, I work with them and we often have to handle issues like this. Common techniques include:
- Changing colours to ensure contrast. In this case, it would mean not colourizing the light icon so it would be known values.
- Increasing the size of the icon or text. Contrast guidelines are based on foreground colour, background colour, and size of the foreground object. Of course, this can only go so far, and wouldn't solve "white on white".
- Controlling the background colour (when a client wants to do a hero image, we usually put a tint behind the text to ensure contrast).
- Adding outlines. While it's easiest to just always add one, it's also possible to calculate contrast ratios and if it's not enough, conditionally add an outline.
I think an outline (conditional or not) would preserve the desired functionality while maintaining usability.
Right now because some of my light icons become too faint or outright invisible, I have to make tweaks to the component manually after each update :(
As I found above, the icon becomes faint/invisible beyond a certain color temp, ie around 5700K.
Perhaps in the code below (which is what I tweak each time), the Kelvin can be maxed out at 5700K or less. Or perhaps re-scale it the output of color_util.color_temperature_mired_to_kelvin(self.color_temp).
elif color_mode == COLOR_MODE_COLOR_TEMP and self.color_temp: hs_color = color_util.color_temperature_to_hs( color_util.color_temperature_mired_to_kelvin(self.color_temp) )
hs_color = color_util.color_temperature_to_hs(2000+0.66*(color_util.color_temperature_mired_to_kelvin(self.color_temp)-2000)) )
I totally support the idea of some sort of outline. That seems like a great way of indicating state, while still allowing accurate full color representation.
The same problem here.
Now that this topic live again and could potentially be resolved soon, I would like to stress out that I personally find this feature useless/confusing BUT I understand why it exists and the fact that many users find it useful. Current state is unusable so the suggestion of adding the outline is great in my opinion but I would once again ask to add the option to completely disable this behavior as well. It could even be as an option, not default setting. As I mentioned few comments above, I believe the most versatile option would be adding a bool setting like state_color
in each card, but I'm open to any setting that would lead to disabling the change of color of the icon (maybe some global setting in lovelace config, though I don't believe it's common practice in HA "config way").
I would suggest adding a boolean for this, something like state_color_temp
or something like that.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
This is still a current issue:

I agree this issue is still there. It does not make sense to leave things as they are so that the icon completely disappears (for me, it is when the color temp exceeds a certain threshold... becomes too cool). Every time there is a new release, I need to patch my workaround, which is to cap the color temp. The color reproduction on the icon is not accurate anymore, but I don't really need that. At least, I can see the light icon.