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
Ensure consistent light state icon brightness #14740
Ensure consistent light state icon brightness #14740
Conversation
private _computeBrightness(stateObj: HassEntity | LightEntity): string { | ||
if (stateObj.attributes.brightness && stateActive(stateObj)) { | ||
const brightness = stateObj.attributes.brightness; | ||
return `brightness(${(brightness + 245) / 5}%)`; | ||
} | ||
return ""; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like this code duplication, but was already present for the _computeColor
as well, so did not change that in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep we can change that in another PR 🙂
There is some changes for the tile card :
There is also some weird think about rgb color on entity card : RGB value are displayed even if the state_color is undefined. We haven't discuss this point. What do you think? |
Which means one cannot really use the tile card next to other existing UI elements since that looks weird/inconsistent. So a user either will have to build a dashboard with only tile cards or only non-tile cards.
Yes that was always an issue, which is one reason why I use a dark theme 😆 so that never comes into play (plus a lot less power consumption from the wall tablets).
I need to check that, but that sounds buggy to me. |
Reg. the last point: Did you mean |
We have rules like this in state-badge (used by entities), entity and button :
So :
3 states boolean 😅 |
We have also differences between tile card and entities card : the off state is grey on tile card and it use the default color for others card. |
Yes, I just saw that coding as well, but I think that has been that way for a long time, so no sense in changing that now. Probably not ideal, but the user can have full control here and with this PR we show the same consistent colors. |
Yes I mentioned that in my PR description. I personally don't like that, since I strive for consistency to clearly communicate the state to the user. One could argue that gray is clearer here for lights, since the default blue could on first glance mean a blue LED (although in most cases you will see also a state indicator either in text form, or a toggle button, round slider, ...). However, blue was always used as the default off state (and still is with the current theming changes). So the tile card goes against the status quo here (with the exclamation mark icon to differentiate for unknown/unavailable), so again inconsistent 😬 . |
private _computeBrightness(stateObj: HassEntity | LightEntity): string { | ||
if (stateObj.attributes.brightness && stateActive(stateObj)) { | ||
const brightness = stateObj.attributes.brightness; | ||
return `brightness(${(brightness + 245) / 5}%)`; | ||
} | ||
return ""; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep we can change that in another PR 🙂
Breaking change
Proposed change
The coloring was off. Some did not use the RGB colors at all, others ignored the brightness.
Now only the tile card is off, where honestly I have no clear idea what it should do in this case design-wise, so I left that one alone.
Before
After
Also note that in the "light off" state the tile card is also inconsistent, which also looks like a bug for the end user.
@piitaya @matthiasdebaat Can you please comment on the tile card points? I think consistency is really key here (more important than any actual used colors IMHO).
There is also a similar, although more narrow PR I just saw: #14724
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: