-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Color palettes should be defined in terms of Color
, not specific color spaces
#12188
Comments
I was really hoping to minimize the use of |
Yeah, I'm not thrilled by it either. But if all of our APIs where we might use a color palette take a |
Well, in my original plan the Gizmo APIs (for example) would take an The problem with using |
So, we would use some type of color as the library default? For example, in gizmos, the default would be |
Also, UI themes are certainly going to be defined in if hovering {
BUTTON_BG.lighten(0.1)
} else if pressed {
BUTTON_BG.lighten(0.2)
} else {
BUTTON_BG
} I can't do this if I can't speak for everyone else, but for me having a lot of |
I'd love to be able to do this, but it doesn't work for bundle types. We're constructing the fields directly :( |
Also, I want to point out that the decision of whether to use This can affect performance, although the specific impact will depend on how often the color field is evaluated. If the conversion is eager, it happens when the user calls the API. If the conversion is lazy, it happens during extraction or whatever internal system Bevy uses for processing the color. The question is, which of those operations happens more often? The answer of course is that it depends on which part of Bevy we're talking about. |
One final (hopefully) comment: I think it's important to accept that there is no perfect solution here. There's an inherent tradeoff between these choices, and we have to pick one or the other and accept the consequences. Using Real games aren't going to use the standard palettes much, if at all. The main user will be debugging displays and gizmos, but even these may opt to define their own color constants. |
Well, I said I was going to shut up about this, but I have one more thought: There's a reason why these colors are defined in sRGB and not in other color spaces, because this is what sRGB is for. The CSS colors, for example, are defined in terms of sRGB values, as are the tailwind colors. If the user needs them in another space, we've made it easy enough to convert. |
What problem does this solve or what need does it fill?
In the course of #12163, I've been working to use the polymorphic
Color
enum as the primary way for end users to supply colors.Because the palettes are stored in
Srgba
, this results in a ton of.into()
orColor::from
calls.What solution would you like?
Just define these palettes in terms of
Color
.Additional context
Migration tracking issue can be found at #12056.
I don't particularly care whether this or #12163 is done first.
The text was updated successfully, but these errors were encountered: