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`.
This commit is contained in:
Antony 2024-03-19 18:50:42 -04:00 committed by GitHub
parent 40f82b867b
commit f38895a414
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View file

@ -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 }
}

View file

@ -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 }
}