Skip to content

Commit f38895a

Browse files
authored
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`.
1 parent 40f82b8 commit f38895a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

crates/bevy_color/src/oklaba.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
1313
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
1414
#[reflect(PartialEq, Serialize, Deserialize, Default)]
1515
pub struct Oklaba {
16-
/// The 'l' channel. [0.0, 1.0]
16+
/// The 'lightness' channel. [0.0, 1.0]
1717
pub lightness: f32,
1818
/// The 'a' channel. [-1.0, 1.0]
1919
pub a: f32,
@@ -61,7 +61,7 @@ impl Oklaba {
6161
}
6262
}
6363

64-
/// Return a copy of this color with the 'l' channel set to the given value.
64+
/// Return a copy of this color with the 'lightness' channel set to the given value.
6565
pub const fn with_lightness(self, lightness: f32) -> Self {
6666
Self { lightness, ..self }
6767
}

crates/bevy_color/src/oklcha.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ impl Oklcha {
5656
}
5757

5858
/// Return a copy of this color with the 'lightness' channel set to the given value.
59-
pub const fn with_l(self, lightness: f32) -> Self {
59+
pub const fn with_lightness(self, lightness: f32) -> Self {
6060
Self { lightness, ..self }
6161
}
6262

6363
/// Return a copy of this color with the 'chroma' channel set to the given value.
64-
pub const fn with_c(self, chroma: f32) -> Self {
64+
pub const fn with_chroma(self, chroma: f32) -> Self {
6565
Self { chroma, ..self }
6666
}
6767

6868
/// Return a copy of this color with the 'hue' channel set to the given value.
69-
pub const fn with_h(self, hue: f32) -> Self {
69+
pub const fn with_hue(self, hue: f32) -> Self {
7070
Self { hue, ..self }
7171
}
7272

0 commit comments

Comments
 (0)