New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistency with defining colors in a default theme #14666
Comments
Many colors already use this type of color. It allow to add opacity to color in CSS. For example : If you define --custom-color: #xxxxxx;
--rgb-custom-color: rrr, ggg, bbb; |
In some components, we need to apply opacity to a css variable. color: rgba(var(--some_var)); You can not do that if your var is not in CSS format. Example of component : tile card Why are you opposed to this? It's just internal, not user facing thing because you can declare the variable in a hexa format. |
Why not parsing "rgba(r,g,b,a)" into "r,g,b,a" before using?
No, I do not see it working.
and this card with "heat" sensor:
As we can see - since the var was defined as "r,g,b,a" in a theme - I cannot use it's "traditional" version to re-define a HEX color. OK, let's define the color as HEX in a theme:
and this card with "connectivity" sensor:
Here I can re-define a color by using "--rgb-state" var with "r,g,b" value. This is an answer to your question:
|
You're not using theme but card_mod third party card. If you define this in your theme, it works : test_new_colors_theme:
state-binary-sensor-alerting-color: "#ff0000" |
Check again my example - the 2nd card, the 1st row - there is NO card-mod here, and the style CANNOT be defined in a theme. |
I fixed my previous message using hexa code. |
Use |
OK, you do not want to allow to use vars externally. But I did not get your feedback regarding "why r,g,b instead of rgb(r,g,b)". |
Feel free to do a PR to replace |
Improving one card (very nice and powerful w/o any doubts) should not be harmful for other cases (((. |
Don't get this one. Maybe I'm lost in your reasoning. Why do you need to refuse usage of css compliant expressions for css? |
Checklist
Describe the issue you are experiencing
Since 2022.12.0, colors in a default theme are defined like "255,255,255" - instead of "rgb(255,255,255)" (or "#ffffff") as it was before.
And this happened to SOME colors (probably to the newly added vars) - check this file:
https://github.com/home-assistant/frontend/blob/f1393e5f00690287a78665faf88ca6145d4aaf48/src/resources/ha-style.ts
example 1:
example 2:
Why colors are defined in different ways?
All variables must have "traditional" versions (i.e. defined as "rgb(255,255,255)" or "#ffffff") which are EXPOSED for external use - for instance, in custom plugins.
Describe the behavior you expected
as above
Steps to reproduce the issue
as above
What version of Home Assistant Core has the issue?
2022.12.0
What was the last working version of Home Assistant Core?
No response
In which browser are you experiencing the issue with?
Chrome 108.0.5359.95
Which operating system are you using to run this browser?
Win10x64
State of relevant entities
No response
Problem-relevant frontend configuration
No response
Javascript errors shown in your browser console/inspector
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: