Struct Lab
pub struct Lab;Expand description
🌌 The CIELAB color space
The CIE L*a*b* color space was created in 1976 to be more perceptually uniform than RGB color spaces, and is both widely used and the basis of other efforts to express colors, including FreieFarbe.
Its components are [L, a, b] with
L- the lightness with a natural bound between 0 and 100, where 0 represents pure black and 100 represents the lightness of white;a- how green/red the color is; andb- how blue/yellow the color is.
a and b are unbounded, but are usually between -160 and 160.
The color space has poor hue linearity and hue uniformity compared with Oklab, though superior lightness uniformity. Note that the lightness range differs from Oklab as well; in Oklab white has a lightness of 1.
The CIE L*a*b* color space is defined in terms of a D50 white point. For conversion between color spaces with other illuminants (especially D65 as in sRGB), the standard Bradform linear chromatic adaptation transform is used.
This corresponds to the color space in CSS Color Module Level 4 § 9.1 .
Lab has a cylindrical counterpart: Lch.
Trait Implementations§
§impl ColorSpace for Lab
impl ColorSpace for Lab
§const TAG: Option<ColorSpaceTag>
const TAG: Option<ColorSpaceTag>
§const WHITE_COMPONENTS: [f32; 3]
const WHITE_COMPONENTS: [f32; 3]
§fn scale_chroma(_: [f32; 3], scale: f32) -> [f32; 3]
fn scale_chroma(_: [f32; 3], scale: f32) -> [f32; 3]
§fn convert<TargetCS>(src: [f32; 3]) -> [f32; 3]where
TargetCS: ColorSpace,
fn convert<TargetCS>(src: [f32; 3]) -> [f32; 3]where
TargetCS: ColorSpace,
§fn clip(_: [f32; 3]) -> [f32; 3]
fn clip(_: [f32; 3]) -> [f32; 3]
§const LAYOUT: ColorSpaceLayout = ColorSpaceLayout::Rectangular
const LAYOUT: ColorSpaceLayout = ColorSpaceLayout::Rectangular
§const WHITE_POINT: Chromaticity = Chromaticity::D65
const WHITE_POINT: Chromaticity = Chromaticity::D65
§fn to_linear_srgb_absolute(src: [f32; 3]) -> [f32; 3]
fn to_linear_srgb_absolute(src: [f32; 3]) -> [f32; 3]
§fn from_linear_srgb_absolute(src: [f32; 3]) -> [f32; 3]
fn from_linear_srgb_absolute(src: [f32; 3]) -> [f32; 3]
§fn convert_absolute<TargetCS>(src: [f32; 3]) -> [f32; 3]where
TargetCS: ColorSpace,
fn convert_absolute<TargetCS>(src: [f32; 3]) -> [f32; 3]where
TargetCS: ColorSpace,
§fn chromatically_adapt(
src: [f32; 3],
from: Chromaticity,
to: Chromaticity,
) -> [f32; 3]
fn chromatically_adapt( src: [f32; 3], from: Chromaticity, to: Chromaticity, ) -> [f32; 3]
§impl From<Lab> for ColorSpaceTag
impl From<Lab> for ColorSpaceTag
§fn from(_: Lab) -> ColorSpaceTag
fn from(_: Lab) -> ColorSpaceTag
impl Copy for Lab
Auto Trait Implementations§
impl Freeze for Lab
impl RefUnwindSafe for Lab
impl Send for Lab
impl Sync for Lab
impl Unpin for Lab
impl UnwindSafe for Lab
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more