[RAINBOW EFFECT] Added methods to get HSL components from Color#9201
[RAINBOW EFFECT] Added methods to get HSL components from Color#9201alice-i-cecile merged 4 commits intobevyengine:mainfrom IDEDARY:main
Conversation
I needed to expose the components of HSL color format for rainbow tweening and color blending. RGBA is not enough. Blending through RGBA goes through white.
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
alice-i-cecile
left a comment
There was a problem hiding this comment.
Consistent with existing code and useful.
I left sRGB mentions in comments for color creation, just removed the ones we talked about.
|
I added another commit removing the comment mentions, now we just need to wait for @mockersf to finish the change request |
|
Example |
|
(note that it segfaulted at the example and that's a known problem with CI right now, but you also have CI validation problems that need to be fixed) /// Color::Hsla
/// to
/// [`Color::Hsla`]
|
Yeah I saw the discussion on Discord about it. I also added the interactive links to my comments as you suggested. |
|
Example |
|
I also kind of noticed that this fixes the same issue as #7759, so I guess cart can decide which PR he likes more. The other PR has more specific naming than mine as I tried to be consistent with existing code. |
|
I approved both because I'm fine with both personally (I know it doesn't help much ^^') |
|
This is fine as is: we can clean things up later if people care enough. |
Changes
Added methods to Color enum to retrieve Hue, Saturation and Lightness values.
Why?
As you probably know, to create a color that iterates over the color spectrum (rainbow effect that can be seen on LED keyboards, PC components, etc..), you need to mix the color from Hue, Saturation and Luminosity. Bevy already supports multiple color formats, but provides only 4 methods of retrieving components for RGBA. Nothing like ".get_hue()", so I implemented them with all their variations that RGBA has.
Now we can do true rainbow color blending (Example is a button hover effect): Discord Showcase, Video download