feat: support for okhsl color space to color plane and color slider#24678
Open
zen-zap wants to merge 12 commits into
Open
feat: support for okhsl color space to color plane and color slider#24678zen-zap wants to merge 12 commits into
zen-zap wants to merge 12 commits into
Conversation
Signed-off-by: zen-zap <pandaashutosh340@gmail.com>
Signed-off-by: zen-zap <pandaashutosh340@gmail.com>
Signed-off-by: zen-zap <pandaashutosh340@gmail.com>
beicause
reviewed
Jun 20, 2026
beicause
left a comment
Member
There was a problem hiding this comment.
I think the shader should prioritize speed over precision, given that render targets generally only have 8 or 16-bit precision.
| return vec3<f32>(C_0, C_mid, C_max); | ||
| } | ||
|
|
||
| fn libm_cbrtf(x: f32) -> f32 { |
Member
There was a problem hiding this comment.
pow(x, 1.0 / 3.0) should be faster, and we already use it in linear_rgb_to_oklab.
Signed-off-by: zen-zap <pandaashutosh340@gmail.com>
Signed-off-by: zen-zap <pandaashutosh340@gmail.com>
Contributor
Author
|
@beicause I updated the functions. |
Contributor
Author
Member
Contributor
Author
ickshonpe
pushed a commit
to ickshonpe/bevy
that referenced
this pull request
Jun 22, 2026
…gine#24691) # Objective Fixes the issues found in bevyengine#24678 (comment) because `LinearRgba::new(1.0, 1.0, 0.9999996, 1.0)` converted to `Okhsla { hue: 104.03624, saturation: NaN, lightness: 1.0, alpha: 1.0 }` which contains NaN. This happens when `oklab_l` == 0 or 1 while `C` != 0, e.g. white minus epsilon ## Solution Early return okhsl/okhsv when oklab lightness approximates 0 or 1. ## Testing Added more color tests. With this fix the okhsl lightness slider looks correct: <img width="1920" height="1006" alt="屏幕截图_20260621_135530" src="https://github.com/user-attachments/assets/8a8723c4-13b9-4240-bfd2-c8d5cfc60717" />
beicause
reviewed
Jun 24, 2026
Member
|
Could you revise the title for accuracy? This adds okhsl to the color sliders and plane. Bevy already supports okhsl color space in Color. |
Signed-off-by: zen-zap <pandaashutosh340@gmail.com>
beicause
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Objective
Solution
OkhslaandOkhslaLongtoInterpolationColorSpace.andin_okhsla_longmethods to theInColorSpace` trait.OkhslHue,OkhslSaturationandOkhslLightnesstoColorChannelenum incrates/bevy_feathers/src/controls/color_slider.rs.okhsl_to_oklabandokhsl_to_linear_rgbmethods inbevy_render/src/color_operations.wgslalong with conversion helpers.bevy_ui_render/src/gradients.rsandbevy_ui_render/src/gradient.wgsl.examples/ui/styling/gradients.rsTesting
Notes
Showcase
There is an extra example row here - 2nd one (will remove that later).