feat: support for okhsl color space#24678
Open
zen-zap wants to merge 9 commits into
Open
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.
| let k_m = -0.105561346 * a - 0.06385417 * b; | ||
| let k_s = -0.08948418 * a - 1.2914855 * b; | ||
|
|
||
| for (var i = 0; i < 2; i = i + 1) { |
Member
There was a problem hiding this comment.
1 step should be sufficient. Then the comment of this function should update.
| let m_dt = dL + dC * k_m; | ||
| let s_dt = dL + dC * k_s; | ||
|
|
||
| for (var i = 0; i < 2; i = i + 1) { |
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
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).