Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d651e12
Expanded gradients testbed ui example scene
ickshonpe Jul 8, 2025
a34ef60
Added gamma constants to gradients shader
ickshonpe Jul 8, 2025
6b896da
Add more example caases
ickshonpe Jul 8, 2025
5033c67
add gamma correction to hsl and hsv conversion functions
ickshonpe Jul 8, 2025
517794a
more examples
ickshonpe Jul 8, 2025
cdd2e77
use gamma constants in srgbs mix function
ickshonpe Jul 8, 2025
204127a
use more accurate gamma functions
ickshonpe Jul 8, 2025
898a93e
Added hue guarding the cylindrical gradients so if the chroma or satu…
ickshonpe Jul 8, 2025
908ccd5
Added row_gap to example layout.
ickshonpe Jul 8, 2025
3df4d3f
Added HUE_GUARD constant
ickshonpe Jul 8, 2025
34d94e0
Add hue guard explanation
ickshonpe Jul 8, 2025
d18dd7a
Unbreak oklch long paths
ickshonpe Jul 8, 2025
593ee53
Merge branch 'main' into more-ui-gradients-fixes
ickshonpe Aug 3, 2025
f512e23
removed left over line from merge
ickshonpe Aug 3, 2025
90f8241
Fixed problems after merge: mix alpha seperately, replaced gamma func…
ickshonpe Aug 3, 2025
465c0c7
Use Normalized hues for oklch colors in gradient.wgsl
ickshonpe Aug 3, 2025
13aeea3
reintroduced hue guards
ickshonpe Aug 3, 2025
2f7251c
Expanded example to include problematic hsl gradients from review.
ickshonpe Aug 4, 2025
d0f66c7
Improved example layout
ickshonpe Aug 4, 2025
d07cab5
Added hue guards to hsl interpolation functions
ickshonpe Aug 4, 2025
eb56beb
Merge branch 'main' into more-ui-gradients-fixes
ickshonpe Aug 4, 2025
dd20eae
Fixed hsl hue interpolation calculation.
ickshonpe Aug 4, 2025
5f31447
Merge branch 'more-ui-gradients-fixes' of https://github.com/ickshonp…
ickshonpe Aug 4, 2025
112f319
Added another gradient to the example.
ickshonpe Aug 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions crates/bevy_ui_render/src/gradient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,8 @@ fn convert_color_to_space(color: LinearRgba, space: InterpolationColorSpace) ->
[
oklcha.lightness,
oklcha.chroma,
oklcha.hue.to_radians(),
// The shader expects normalized hues
oklcha.hue / 360.,
oklcha.alpha,
]
}
Expand All @@ -676,18 +677,13 @@ fn convert_color_to_space(color: LinearRgba, space: InterpolationColorSpace) ->
InterpolationColorSpace::LinearRgba => color.to_f32_array(),
InterpolationColorSpace::Hsla | InterpolationColorSpace::HslaLong => {
let hsla: Hsla = color.into();
// Normalize hue to 0..1 range for shader
[
hsla.hue / 360.0,
hsla.saturation,
hsla.lightness,
hsla.alpha,
]
// The shader expects normalized hues
[hsla.hue / 360., hsla.saturation, hsla.lightness, hsla.alpha]
}
InterpolationColorSpace::Hsva | InterpolationColorSpace::HsvaLong => {
let hsva: Hsva = color.into();
// Normalize hue to 0..1 range for shader
[hsva.hue / 360.0, hsva.saturation, hsva.value, hsva.alpha]
// The shader expects normalized hues
[hsva.hue / 360., hsva.saturation, hsva.value, hsva.alpha]
}
}
}
Expand Down
Loading
Loading