From f38895a414f605578d81a6d99a58e1478767e0a5 Mon Sep 17 00:00:00 2001 From: Antony Date: Tue, 19 Mar 2024 18:50:42 -0400 Subject: [PATCH] Fix `Oklab` and `Oklch` color space inconsistency (#12583) # Objective Fixes #12224. ## Solution - Expand `with_` methods for the `Oklch` to their full names. - Expand `l` to `lightness` in `Oklaba` comments. ## Migration Guide The following methods have been renamed for the `Oklch` color space: - `with_l` -> `with_lightness`. - `with_c` -> `with_chroma`. - `with_h` -> `with_hue`. --- crates/bevy_color/src/oklaba.rs | 4 ++-- crates/bevy_color/src/oklcha.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/bevy_color/src/oklaba.rs b/crates/bevy_color/src/oklaba.rs index 4da4c805fb..5501e8e4c6 100644 --- a/crates/bevy_color/src/oklaba.rs +++ b/crates/bevy_color/src/oklaba.rs @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)] #[reflect(PartialEq, Serialize, Deserialize, Default)] pub struct Oklaba { - /// The 'l' channel. [0.0, 1.0] + /// The 'lightness' channel. [0.0, 1.0] pub lightness: f32, /// The 'a' channel. [-1.0, 1.0] pub a: f32, @@ -61,7 +61,7 @@ impl Oklaba { } } - /// Return a copy of this color with the 'l' channel set to the given value. + /// Return a copy of this color with the 'lightness' channel set to the given value. pub const fn with_lightness(self, lightness: f32) -> Self { Self { lightness, ..self } } diff --git a/crates/bevy_color/src/oklcha.rs b/crates/bevy_color/src/oklcha.rs index 4185990e5d..133794e256 100644 --- a/crates/bevy_color/src/oklcha.rs +++ b/crates/bevy_color/src/oklcha.rs @@ -56,17 +56,17 @@ impl Oklcha { } /// Return a copy of this color with the 'lightness' channel set to the given value. - pub const fn with_l(self, lightness: f32) -> Self { + pub const fn with_lightness(self, lightness: f32) -> Self { Self { lightness, ..self } } /// Return a copy of this color with the 'chroma' channel set to the given value. - pub const fn with_c(self, chroma: f32) -> Self { + pub const fn with_chroma(self, chroma: f32) -> Self { Self { chroma, ..self } } /// Return a copy of this color with the 'hue' channel set to the given value. - pub const fn with_h(self, hue: f32) -> Self { + pub const fn with_hue(self, hue: f32) -> Self { Self { hue, ..self } }