-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[RAINBOW EFFECT] Added methods to get HSL components from Color #9201
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 ✨ |
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.
Consistent with existing code and useful.
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.
LGTM
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