Skip to content

Commit 2cb8450

Browse files
authored
Rename the InterpolationColorSpace variants to match Color. (#20142)
# Objective The names of the variants of `InterpolationColorSpace` don't match the corresponding `Color` variants, which could be potentially confusing. For instance, `Color` has an `Oklaba` variant, in `InterpolationColorSpace` it's called `OkLab`. ## Solution Rename variants of `InterpolationColorSpace` to mirror the variants of Color.
1 parent 6edfe1d commit 2cb8450

File tree

5 files changed

+61
-61
lines changed

5 files changed

+61
-61
lines changed

crates/bevy_feathers/src/controls/slider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn slider<B: Bundle>(props: SliderProps, overrides: B) -> impl Bundle {
9999
ColorStop::new(Color::NONE, Val::Percent(50.)),
100100
ColorStop::new(Color::NONE, Val::Percent(100.)),
101101
],
102-
color_space: InterpolationColorSpace::Srgb,
102+
color_space: InterpolationColorSpace::Srgba,
103103
})]),
104104
overrides,
105105
children![(

crates/bevy_ui/src/gradients.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -638,25 +638,25 @@ impl RadialGradientShape {
638638
reflect(Serialize, Deserialize)
639639
)]
640640
pub enum InterpolationColorSpace {
641-
/// Interpolates in `OKLab` space.
641+
/// Interpolates in OKLABA space.
642642
#[default]
643-
OkLab,
644-
/// Interpolates in OKLCH space, taking the shortest hue path.
645-
OkLch,
646-
/// Interpolates in OKLCH space, taking the longest hue path.
647-
OkLchLong,
648-
/// Interpolates in sRGB space.
649-
Srgb,
650-
/// Interpolates in linear sRGB space.
651-
LinearRgb,
652-
/// Interpolates in HSL space, taking the shortest hue path.
653-
Hsl,
654-
/// Interpolates in HSL space, taking the longest hue path.
655-
HslLong,
656-
/// Interpolates in HSV space, taking the shortest hue path.
657-
Hsv,
658-
/// Interpolates in HSV space, taking the longest hue path.
659-
HsvLong,
643+
Oklaba,
644+
/// Interpolates in OKLCHA space, taking the shortest hue path.
645+
Oklcha,
646+
/// Interpolates in OKLCHA space, taking the longest hue path.
647+
OklchaLong,
648+
/// Interpolates in sRGBA space.
649+
Srgba,
650+
/// Interpolates in linear sRGBA space.
651+
LinearRgba,
652+
/// Interpolates in HSLA space, taking the shortest hue path.
653+
Hsla,
654+
/// Interpolates in HSLA space, taking the longest hue path.
655+
HslaLong,
656+
/// Interpolates in HSVA space, taking the shortest hue path.
657+
Hsva,
658+
/// Interpolates in HSVA space, taking the longest hue path.
659+
HsvaLong,
660660
}
661661

662662
/// Set the color space used for interpolation.
@@ -665,28 +665,28 @@ pub trait InColorSpace: Sized {
665665
fn in_color_space(self, color_space: InterpolationColorSpace) -> Self;
666666

667667
/// Interpolate in `OKLab` space.
668-
fn in_oklab(self) -> Self {
669-
self.in_color_space(InterpolationColorSpace::OkLab)
668+
fn in_oklaba(self) -> Self {
669+
self.in_color_space(InterpolationColorSpace::Oklaba)
670670
}
671671

672672
/// Interpolate in OKLCH space (short hue path).
673673
fn in_oklch(self) -> Self {
674-
self.in_color_space(InterpolationColorSpace::OkLch)
674+
self.in_color_space(InterpolationColorSpace::Oklcha)
675675
}
676676

677677
/// Interpolate in OKLCH space (long hue path).
678678
fn in_oklch_long(self) -> Self {
679-
self.in_color_space(InterpolationColorSpace::OkLchLong)
679+
self.in_color_space(InterpolationColorSpace::OklchaLong)
680680
}
681681

682682
/// Interpolate in sRGB space.
683683
fn in_srgb(self) -> Self {
684-
self.in_color_space(InterpolationColorSpace::Srgb)
684+
self.in_color_space(InterpolationColorSpace::Srgba)
685685
}
686686

687687
/// Interpolate in linear sRGB space.
688688
fn in_linear_rgb(self) -> Self {
689-
self.in_color_space(InterpolationColorSpace::LinearRgb)
689+
self.in_color_space(InterpolationColorSpace::LinearRgba)
690690
}
691691
}
692692

crates/bevy_ui_render/src/gradient.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ impl SpecializedRenderPipeline for GradientPipeline {
181181
],
182182
);
183183
let color_space = match key.color_space {
184-
InterpolationColorSpace::OkLab => "IN_OKLAB",
185-
InterpolationColorSpace::OkLch => "IN_OKLCH",
186-
InterpolationColorSpace::OkLchLong => "IN_OKLCH_LONG",
187-
InterpolationColorSpace::Srgb => "IN_SRGB",
188-
InterpolationColorSpace::LinearRgb => "IN_LINEAR_RGB",
189-
InterpolationColorSpace::Hsl => "IN_HSL",
190-
InterpolationColorSpace::HslLong => "IN_HSL_LONG",
191-
InterpolationColorSpace::Hsv => "IN_HSV",
192-
InterpolationColorSpace::HsvLong => "IN_HSV_LONG",
184+
InterpolationColorSpace::Oklaba => "IN_OKLAB",
185+
InterpolationColorSpace::Oklcha => "IN_OKLCH",
186+
InterpolationColorSpace::OklchaLong => "IN_OKLCH_LONG",
187+
InterpolationColorSpace::Srgba => "IN_SRGB",
188+
InterpolationColorSpace::LinearRgba => "IN_LINEAR_RGB",
189+
InterpolationColorSpace::Hsla => "IN_HSL",
190+
InterpolationColorSpace::HslaLong => "IN_HSL_LONG",
191+
InterpolationColorSpace::Hsva => "IN_HSV",
192+
InterpolationColorSpace::HsvaLong => "IN_HSV_LONG",
193193
};
194194

195195
let shader_defs = if key.anti_alias {

examples/testbed/ui.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -597,15 +597,15 @@ mod linear_gradient {
597597
],
598598
] {
599599
for color_space in [
600-
InterpolationColorSpace::LinearRgb,
601-
InterpolationColorSpace::Srgb,
602-
InterpolationColorSpace::OkLab,
603-
InterpolationColorSpace::OkLch,
604-
InterpolationColorSpace::OkLchLong,
605-
InterpolationColorSpace::Hsl,
606-
InterpolationColorSpace::HslLong,
607-
InterpolationColorSpace::Hsv,
608-
InterpolationColorSpace::HsvLong,
600+
InterpolationColorSpace::LinearRgba,
601+
InterpolationColorSpace::Srgba,
602+
InterpolationColorSpace::Oklaba,
603+
InterpolationColorSpace::Oklcha,
604+
InterpolationColorSpace::OklchaLong,
605+
InterpolationColorSpace::Hsla,
606+
InterpolationColorSpace::HslaLong,
607+
InterpolationColorSpace::Hsva,
608+
InterpolationColorSpace::HsvaLong,
609609
] {
610610
commands.spawn((
611611
Node {

examples/ui/gradients.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -232,32 +232,32 @@ fn setup(mut commands: Commands) {
232232
}
233233
};
234234
*space = match *space {
235-
InterpolationColorSpace::OkLab => {
236-
InterpolationColorSpace::OkLch
235+
InterpolationColorSpace::Oklaba => {
236+
InterpolationColorSpace::Oklcha
237237
}
238-
InterpolationColorSpace::OkLch => {
239-
InterpolationColorSpace::OkLchLong
238+
InterpolationColorSpace::Oklcha => {
239+
InterpolationColorSpace::OklchaLong
240240
}
241-
InterpolationColorSpace::OkLchLong => {
242-
InterpolationColorSpace::Srgb
241+
InterpolationColorSpace::OklchaLong => {
242+
InterpolationColorSpace::Srgba
243243
}
244-
InterpolationColorSpace::Srgb => {
245-
InterpolationColorSpace::LinearRgb
244+
InterpolationColorSpace::Srgba => {
245+
InterpolationColorSpace::LinearRgba
246246
}
247-
InterpolationColorSpace::LinearRgb => {
248-
InterpolationColorSpace::Hsl
247+
InterpolationColorSpace::LinearRgba => {
248+
InterpolationColorSpace::Hsla
249249
}
250-
InterpolationColorSpace::Hsl => {
251-
InterpolationColorSpace::HslLong
250+
InterpolationColorSpace::Hsla => {
251+
InterpolationColorSpace::HslaLong
252252
}
253-
InterpolationColorSpace::HslLong => {
254-
InterpolationColorSpace::Hsv
253+
InterpolationColorSpace::HslaLong => {
254+
InterpolationColorSpace::Hsva
255255
}
256-
InterpolationColorSpace::Hsv => {
257-
InterpolationColorSpace::HsvLong
256+
InterpolationColorSpace::Hsva => {
257+
InterpolationColorSpace::HsvaLong
258258
}
259-
InterpolationColorSpace::HsvLong => {
260-
InterpolationColorSpace::OkLab
259+
InterpolationColorSpace::HsvaLong => {
260+
InterpolationColorSpace::Oklaba
261261
}
262262
};
263263
current_space = *space;

0 commit comments

Comments
 (0)