Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Oklab and Oklch color space inconsistency #12583

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions crates/bevy_color/src/oklaba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -59,7 +59,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 }
}
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_color/src/oklcha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

Expand Down