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

RGBW colors #84

Open
rbhun opened this issue Aug 14, 2024 · 2 comments
Open

RGBW colors #84

rbhun opened this issue Aug 14, 2024 · 2 comments

Comments

@rbhun
Copy link

rbhun commented Aug 14, 2024

Hi

just wanted to add, RGBW leds are working too, like this:

colors:
  - rgbw_color:
      - 200
      - 0
      - 0
      - 100
    brightness: 155

however, the icon color does not take into account the white channel, so a 0,0,0,100 would be black instead of white. I fixed that with adding icon_color: white, but it would be better representation of colours if the W channel is added.

@bokub
Copy link
Owner

bokub commented Sep 20, 2024

That's right. Do you have any algorithm or code to suggest, that could calculate the icon color based on a RGBW or RGBWW array ?

Thanks

Also, duplicate of #79

@j9brown
Copy link

j9brown commented Dec 28, 2024

For RGB/W and RGB/WW/CW a simple expedient would be to choose an RGB color to represent warm white and another one for cold white. Scale the appropriate WW and CW colors by the brightness of their color channels and add them to the RGB color of the remaining channels. If the resulting RGB color has components greater than 100% then divide all components by the largest component to normalize it.

For more general color temperature to RGB, check out this algorithm (which I have used before in another project): https://tannerhelland.com/2012/09/18/convert-temperature-rgb-algorithm-code.html

You can also use the same algorithm to choose the representative WW and CW colors given an assumed (or provided) color temperature for each channel.

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