-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Color interpolation in OKLab, OKLCH spaces for UI gradients #19330
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
base: main
Are you sure you want to change the base?
Color interpolation in OKLab, OKLCH spaces for UI gradients #19330
Conversation
* Added color space specialization to gradients pipeline. * Added support for interpolation in OkLch and OkLab color spaces to shader. * Added color space fields to each gradient type. * Updated examples.
Why do we need this rather than using |
The enum is just mapped to a constant that is sent to the shader, so using an enum seemed simplest. For polar color spaces you need to choose a path, so using a color type as a discriminator wouldn't be sufficient. It would be nicer if this was more unified with |
Sounds good. I'm fine to punt on that , but I would like to move this into bevy_color at some point. Linebender's color crate is also doing similar things for shader color math long-term. |
Objective
Add support for interpolation in OKLab and OKLCH color spaces for UI gradients.
Solution
InterpolationColorSpace
enum withOkLab
,OkLch
,OkLchLong
,Srgb
andLinearRgb
variants.bevy_color
except that interpolation in polar space uses radians.color_space
fields to each gradient type.InterpolationColorSpace
might be a bit long, might change it toInterpolationMethod
or something.Testing
The
gradients
example has been updated to demonstrate the different color interpolation methods.Press space to cycle through the different options.
Showcase