#[repr(C)]pub struct Oklab {
pub l: f32,
pub a: f32,
pub b: f32,
}
Expand description
A color in Oklab is represented with three coordinates, similar to how CIELAB works, but with better perceptual properties.
Oklab uses a D65 whitepoint, since this is what sRGB and other common color spaces use.
Fields§
§l: f32
L – perceived lightness
a: f32
a – how green/red the color is
b: f32
b – how blue/yellow the color is
Implementations§
Source§impl Oklab
impl Oklab
Sourcepub fn to_srgb_f32(&self) -> Rgb<f32>
pub fn to_srgb_f32(&self) -> Rgb<f32>
Converts Oklab to sRGB color in range 0..=1
Sourcepub fn to_linear_rgb(&self) -> Rgb<f32>
pub fn to_linear_rgb(&self) -> Rgb<f32>
Converts Oklab to linear sRGB (in 0..1 range)
(this is what is usually called a “linear light” or “without gamma” RGB.)
Outputs aren’t clamped, and can be negative or slightly over 1.0 due to floating-point rounding errors.
Sourcepub fn from_linear_rgb(rgb: Rgb<f32>) -> Oklab
pub fn from_linear_rgb(rgb: Rgb<f32>) -> Oklab
Converts linear sRGB (in 0..1 range) to Oklab
(this is what is usually called a “linear light” or “without gamma” RGB.)
Trait Implementations§
Source§impl PartialOrd for Oklab
impl PartialOrd for Oklab
impl Copy for Oklab
impl StructuralPartialEq for Oklab
Auto Trait Implementations§
impl Freeze for Oklab
impl RefUnwindSafe for Oklab
impl Send for Oklab
impl Sync for Oklab
impl Unpin for Oklab
impl UnwindSafe for Oklab
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more