bokub / rgb-light-card

💡 A Lovelace custom card for RGB lights
MIT License
412 stars 24 forks source link

Auto-colors don't factor in brightness? #79

Open Josephtsessions opened 10 months ago

Josephtsessions commented 10 months ago

First, this card is so elegant and has really made managing lighting much nicer for me. Thank you so much!

Accd to the code, if an RGB light uses RGB values, the icon color is based only on RGB.

In other words, if you have two RGB light colors side by side who differ only in the light brightness, they look identical even if the brightness difference is huge!

image

In this case Test 1 and Test 2 have 27 and 180 brightness respectively.

Even without duplicated colors, it makes it harder to visualize the expected change to the light. If brightness were factored in, it'd be easier to see what's about to happen more clearly before making a change to lighting.

Accd to the code here, brightness is only factored in if color isn't specified otherwise. I'd think one solution would be returning an rgba instead of an rgb unconditionally for colors at full brightness unless brightness was specified, then setting the alpha value like is being done on that line.

Thoughts? Think this would add value?

bokub commented 10 months ago

Hi!

Thanks for the suggestion, but rbga would give different results depending on your card background. Some people use light mode, and others use dark mode

However, darkening the color if brightness is below 100% would not be a bad idea. Don't hesitate to submit a PR if you have the time!

In the meantime, you can still use the icon_color option to change color of the second icon yourself

bokub commented 10 months ago

I'm now realizing that there is the same problem with rgbw_color and rgbww_color, only the R, G and B values are taken in account for the icon color (not the whites). However, I'm not sure what would be the best for these to look good...