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.
This commit is contained in:
parent
6edfe1d39b
commit
2cb8450fa4
@ -99,7 +99,7 @@ pub fn slider<B: Bundle>(props: SliderProps, overrides: B) -> impl Bundle {
|
|||||||
ColorStop::new(Color::NONE, Val::Percent(50.)),
|
ColorStop::new(Color::NONE, Val::Percent(50.)),
|
||||||
ColorStop::new(Color::NONE, Val::Percent(100.)),
|
ColorStop::new(Color::NONE, Val::Percent(100.)),
|
||||||
],
|
],
|
||||||
color_space: InterpolationColorSpace::Srgb,
|
color_space: InterpolationColorSpace::Srgba,
|
||||||
})]),
|
})]),
|
||||||
overrides,
|
overrides,
|
||||||
children![(
|
children![(
|
||||||
|
@ -638,25 +638,25 @@ impl RadialGradientShape {
|
|||||||
reflect(Serialize, Deserialize)
|
reflect(Serialize, Deserialize)
|
||||||
)]
|
)]
|
||||||
pub enum InterpolationColorSpace {
|
pub enum InterpolationColorSpace {
|
||||||
/// Interpolates in `OKLab` space.
|
/// Interpolates in OKLABA space.
|
||||||
#[default]
|
#[default]
|
||||||
OkLab,
|
Oklaba,
|
||||||
/// Interpolates in OKLCH space, taking the shortest hue path.
|
/// Interpolates in OKLCHA space, taking the shortest hue path.
|
||||||
OkLch,
|
Oklcha,
|
||||||
/// Interpolates in OKLCH space, taking the longest hue path.
|
/// Interpolates in OKLCHA space, taking the longest hue path.
|
||||||
OkLchLong,
|
OklchaLong,
|
||||||
/// Interpolates in sRGB space.
|
/// Interpolates in sRGBA space.
|
||||||
Srgb,
|
Srgba,
|
||||||
/// Interpolates in linear sRGB space.
|
/// Interpolates in linear sRGBA space.
|
||||||
LinearRgb,
|
LinearRgba,
|
||||||
/// Interpolates in HSL space, taking the shortest hue path.
|
/// Interpolates in HSLA space, taking the shortest hue path.
|
||||||
Hsl,
|
Hsla,
|
||||||
/// Interpolates in HSL space, taking the longest hue path.
|
/// Interpolates in HSLA space, taking the longest hue path.
|
||||||
HslLong,
|
HslaLong,
|
||||||
/// Interpolates in HSV space, taking the shortest hue path.
|
/// Interpolates in HSVA space, taking the shortest hue path.
|
||||||
Hsv,
|
Hsva,
|
||||||
/// Interpolates in HSV space, taking the longest hue path.
|
/// Interpolates in HSVA space, taking the longest hue path.
|
||||||
HsvLong,
|
HsvaLong,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the color space used for interpolation.
|
/// Set the color space used for interpolation.
|
||||||
@ -665,28 +665,28 @@ pub trait InColorSpace: Sized {
|
|||||||
fn in_color_space(self, color_space: InterpolationColorSpace) -> Self;
|
fn in_color_space(self, color_space: InterpolationColorSpace) -> Self;
|
||||||
|
|
||||||
/// Interpolate in `OKLab` space.
|
/// Interpolate in `OKLab` space.
|
||||||
fn in_oklab(self) -> Self {
|
fn in_oklaba(self) -> Self {
|
||||||
self.in_color_space(InterpolationColorSpace::OkLab)
|
self.in_color_space(InterpolationColorSpace::Oklaba)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Interpolate in OKLCH space (short hue path).
|
/// Interpolate in OKLCH space (short hue path).
|
||||||
fn in_oklch(self) -> Self {
|
fn in_oklch(self) -> Self {
|
||||||
self.in_color_space(InterpolationColorSpace::OkLch)
|
self.in_color_space(InterpolationColorSpace::Oklcha)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Interpolate in OKLCH space (long hue path).
|
/// Interpolate in OKLCH space (long hue path).
|
||||||
fn in_oklch_long(self) -> Self {
|
fn in_oklch_long(self) -> Self {
|
||||||
self.in_color_space(InterpolationColorSpace::OkLchLong)
|
self.in_color_space(InterpolationColorSpace::OklchaLong)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Interpolate in sRGB space.
|
/// Interpolate in sRGB space.
|
||||||
fn in_srgb(self) -> Self {
|
fn in_srgb(self) -> Self {
|
||||||
self.in_color_space(InterpolationColorSpace::Srgb)
|
self.in_color_space(InterpolationColorSpace::Srgba)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Interpolate in linear sRGB space.
|
/// Interpolate in linear sRGB space.
|
||||||
fn in_linear_rgb(self) -> Self {
|
fn in_linear_rgb(self) -> Self {
|
||||||
self.in_color_space(InterpolationColorSpace::LinearRgb)
|
self.in_color_space(InterpolationColorSpace::LinearRgba)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,15 +181,15 @@ impl SpecializedRenderPipeline for GradientPipeline {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
let color_space = match key.color_space {
|
let color_space = match key.color_space {
|
||||||
InterpolationColorSpace::OkLab => "IN_OKLAB",
|
InterpolationColorSpace::Oklaba => "IN_OKLAB",
|
||||||
InterpolationColorSpace::OkLch => "IN_OKLCH",
|
InterpolationColorSpace::Oklcha => "IN_OKLCH",
|
||||||
InterpolationColorSpace::OkLchLong => "IN_OKLCH_LONG",
|
InterpolationColorSpace::OklchaLong => "IN_OKLCH_LONG",
|
||||||
InterpolationColorSpace::Srgb => "IN_SRGB",
|
InterpolationColorSpace::Srgba => "IN_SRGB",
|
||||||
InterpolationColorSpace::LinearRgb => "IN_LINEAR_RGB",
|
InterpolationColorSpace::LinearRgba => "IN_LINEAR_RGB",
|
||||||
InterpolationColorSpace::Hsl => "IN_HSL",
|
InterpolationColorSpace::Hsla => "IN_HSL",
|
||||||
InterpolationColorSpace::HslLong => "IN_HSL_LONG",
|
InterpolationColorSpace::HslaLong => "IN_HSL_LONG",
|
||||||
InterpolationColorSpace::Hsv => "IN_HSV",
|
InterpolationColorSpace::Hsva => "IN_HSV",
|
||||||
InterpolationColorSpace::HsvLong => "IN_HSV_LONG",
|
InterpolationColorSpace::HsvaLong => "IN_HSV_LONG",
|
||||||
};
|
};
|
||||||
|
|
||||||
let shader_defs = if key.anti_alias {
|
let shader_defs = if key.anti_alias {
|
||||||
|
@ -597,15 +597,15 @@ mod linear_gradient {
|
|||||||
],
|
],
|
||||||
] {
|
] {
|
||||||
for color_space in [
|
for color_space in [
|
||||||
InterpolationColorSpace::LinearRgb,
|
InterpolationColorSpace::LinearRgba,
|
||||||
InterpolationColorSpace::Srgb,
|
InterpolationColorSpace::Srgba,
|
||||||
InterpolationColorSpace::OkLab,
|
InterpolationColorSpace::Oklaba,
|
||||||
InterpolationColorSpace::OkLch,
|
InterpolationColorSpace::Oklcha,
|
||||||
InterpolationColorSpace::OkLchLong,
|
InterpolationColorSpace::OklchaLong,
|
||||||
InterpolationColorSpace::Hsl,
|
InterpolationColorSpace::Hsla,
|
||||||
InterpolationColorSpace::HslLong,
|
InterpolationColorSpace::HslaLong,
|
||||||
InterpolationColorSpace::Hsv,
|
InterpolationColorSpace::Hsva,
|
||||||
InterpolationColorSpace::HsvLong,
|
InterpolationColorSpace::HsvaLong,
|
||||||
] {
|
] {
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Node {
|
Node {
|
||||||
|
@ -232,32 +232,32 @@ fn setup(mut commands: Commands) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
*space = match *space {
|
*space = match *space {
|
||||||
InterpolationColorSpace::OkLab => {
|
InterpolationColorSpace::Oklaba => {
|
||||||
InterpolationColorSpace::OkLch
|
InterpolationColorSpace::Oklcha
|
||||||
}
|
}
|
||||||
InterpolationColorSpace::OkLch => {
|
InterpolationColorSpace::Oklcha => {
|
||||||
InterpolationColorSpace::OkLchLong
|
InterpolationColorSpace::OklchaLong
|
||||||
}
|
}
|
||||||
InterpolationColorSpace::OkLchLong => {
|
InterpolationColorSpace::OklchaLong => {
|
||||||
InterpolationColorSpace::Srgb
|
InterpolationColorSpace::Srgba
|
||||||
}
|
}
|
||||||
InterpolationColorSpace::Srgb => {
|
InterpolationColorSpace::Srgba => {
|
||||||
InterpolationColorSpace::LinearRgb
|
InterpolationColorSpace::LinearRgba
|
||||||
}
|
}
|
||||||
InterpolationColorSpace::LinearRgb => {
|
InterpolationColorSpace::LinearRgba => {
|
||||||
InterpolationColorSpace::Hsl
|
InterpolationColorSpace::Hsla
|
||||||
}
|
}
|
||||||
InterpolationColorSpace::Hsl => {
|
InterpolationColorSpace::Hsla => {
|
||||||
InterpolationColorSpace::HslLong
|
InterpolationColorSpace::HslaLong
|
||||||
}
|
}
|
||||||
InterpolationColorSpace::HslLong => {
|
InterpolationColorSpace::HslaLong => {
|
||||||
InterpolationColorSpace::Hsv
|
InterpolationColorSpace::Hsva
|
||||||
}
|
}
|
||||||
InterpolationColorSpace::Hsv => {
|
InterpolationColorSpace::Hsva => {
|
||||||
InterpolationColorSpace::HsvLong
|
InterpolationColorSpace::HsvaLong
|
||||||
}
|
}
|
||||||
InterpolationColorSpace::HsvLong => {
|
InterpolationColorSpace::HsvaLong => {
|
||||||
InterpolationColorSpace::OkLab
|
InterpolationColorSpace::Oklaba
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
current_space = *space;
|
current_space = *space;
|
||||||
|
Loading…
Reference in New Issue
Block a user