Add support for getting and setting the Chroma value of an LCHA color#10374
Add support for getting and setting the Chroma value of an LCHA color#10374Tam wants to merge 2 commits intobevyengine:mainfrom
Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
|
Colors methods are getting harder to grok, with more and more methods with a single letter available on all variants... |
|
To preface, I am a big fan of LCHA colors in Bevy myself, and I use them in my projects. :) I am not happy about the current state of this for a number of reasons. Without this PR, LCH is kinda neglected and clunky to work with, due to the missing APIs (compared to RGB and HSL). With this PR ... you only add methods for C. Which is weird and confusing. What about the other LCHA components? Why only chroma? Though ... Clearly, we have a problem. The L and H letters overlap between HSL and LCH, but mean vastly different things. We can't just add a My proposed solution would be to rename the existing HSL methods, to make it clear that they are for working with HSL, and introduce a full set of methods for LCH using the same naming scheme. One suggestion is to just put the color space in the name:
That way, it is always clear what color space you are working with, and the API is "complete", covering all the possibilities. I think we shouldn't rename the RGB methods, though. RGB is the most common color space that most Bevy users work with the most. It can be considered the "standard", and HSL/LCH are the "alternatives". The RGB letters are also clear and unambiguous. So I think it is fine to have the short and concise names |
|
This should be fixed now, with the addition of bevy_color. |
Objective
Give chroma the attention it deserves
Solution
Changelog
Added
c(),set_c(), andwith_c()to theColorstruct