Skip to content
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

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

Open
Josephtsessions opened this issue Oct 5, 2023 · 4 comments
Open

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

Josephtsessions opened this issue Oct 5, 2023 · 4 comments

Comments

@Josephtsessions
Copy link

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
Copy link
Owner

bokub commented Oct 5, 2023

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
Copy link
Owner

bokub commented Oct 5, 2023

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...

@bokub bokub mentioned this issue Sep 20, 2024
@rbhun
Copy link

rbhun commented Sep 20, 2024

I did some quick research and there are formulas to convert.
the best I found is here: https://github.com/iamh2o/rgbw_colorspace_converter/

but this actually has several formulas discussed. they do start with an RGB->RGBW converter though.

https://stackoverflow.com/questions/21117842/converting-an-rgbw-color-to-a-standard-rgb-hsb-representation

@bokub
Copy link
Owner

bokub commented Sep 20, 2024

The stackoverflow formula looks simple enough, I'll do some tests if I find some free time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants