pub struct Lab<T: Float + Send + Sync> { /* private fields */ }
Expand description
LAB colour representation.
Implementations§
Source§impl<T: Float + Send + Sync> Lab<T>
impl<T: Float + Send + Sync> Lab<T>
Sourcepub fn set_lightness(&mut self, lightness: T)
pub fn set_lightness(&mut self, lightness: T)
Sourcepub fn set_a_star(&mut self, a_star: T)
pub fn set_a_star(&mut self, a_star: T)
Sourcepub fn set_b_star(&mut self, b_star: T)
pub fn set_b_star(&mut self, b_star: T)
Sourcepub fn delta_e(&self, other: &Self) -> T
pub fn delta_e(&self, other: &Self) -> T
Calculate perceptual colour difference in Lab space (CIE76 Delta E). The Delta E value indicates how different two colours appear, with values:
- < 1.0: Not perceptible by human eyes
- 1-2: Perceptible through close observation
- 2-10: Perceptible at a glance
-
10: Colours are more similar than opposite
Trait Implementations§
Source§impl<T: Float + Send + Sync> Colour<T, 3> for Lab<T>
impl<T: Float + Send + Sync> Colour<T, 3> for Lab<T>
Source§fn lerp(lhs: &Self, rhs: &Self, t: T) -> Self
fn lerp(lhs: &Self, rhs: &Self, t: T) -> Self
Linear interpolate between two Lab colours.
Lab is designed to be perceptually uniform, so linear interpolation in this space produces perceptually uniform gradients.
Source§fn from_hex(hex: &str) -> Result<Self, ParseColourError<ParseIntError>>
fn from_hex(hex: &str) -> Result<Self, ParseColourError<ParseIntError>>
Create a new colour from a hex string. Read more
Source§fn from_bytes(bytes: [u8; 3]) -> Self
fn from_bytes(bytes: [u8; 3]) -> Self
Create a new colour from a byte array.
Source§const NUM_COMPONENTS: usize = N
const NUM_COMPONENTS: usize = N
Number of components in the colour.
Source§impl<T: Float + Send + Sync> Convert<T> for Lab<T>
impl<T: Float + Send + Sync> Convert<T> for Lab<T>
fn to_grey(&self) -> Grey<T>
fn to_grey_alpha(&self) -> GreyAlpha<T>
fn to_hsl(&self) -> Hsl<T>
fn to_hsl_alpha(&self) -> HslAlpha<T>
fn to_hsv(&self) -> Hsv<T>
fn to_hsv_alpha(&self) -> HsvAlpha<T>
fn to_lab(&self) -> Self
fn to_lab_alpha(&self) -> LabAlpha<T>
fn to_rgb(&self) -> Rgb<T>
fn to_rgb_alpha(&self) -> RgbAlpha<T>
fn to_srgb(&self) -> Srgb<T>
fn to_srgb_alpha(&self) -> SrgbAlpha<T>
fn to_xyz(&self) -> Xyz<T>
fn to_xyz_alpha(&self) -> XyzAlpha<T>
impl<T: Copy + Float + Send + Sync> Copy for Lab<T>
Auto Trait Implementations§
impl<T> Freeze for Lab<T>where
T: Freeze,
impl<T> RefUnwindSafe for Lab<T>where
T: RefUnwindSafe,
impl<T> Send for Lab<T>
impl<T> Sync for Lab<T>
impl<T> Unpin for Lab<T>where
T: Unpin,
impl<T> UnwindSafe for Lab<T>where
T: UnwindSafe,
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