Struct palette::Lab [] [src]

pub struct Lab<T: Float = f32> {
    pub l: T,
    pub a: T,
    pub b: T,
}

The CIE L*a*b* (CIELAB) color space.

CIE L*a*b* is a device independent color space which includes all perceivable colors. It's sometimes used to convert between other color spaces, because of its ability to represent all of their colors, and sometimes in color manipulation, because of its perceptual uniformity. This means that the perceptual difference between two colors is equal to their numerical difference.

The parameters of L*a*b* are quite different, compared to many other color spaces, so manipulating them manually can be unintuitive.

Fields

l: T

L* is the lightness of the color. 0.0 gives absolute black and 1.0 give the brightest white.

a: T

a* goes from red at -1.0 to green at 1.0.

b: T

b* goes from yellow at -1.0 to blue at 1.0.

Methods

impl<T: Float> Lab<T>
[src]

fn new(l: T, a: T, b: T) -> Lab<T>

CIE L*a*b*.

Trait Implementations

impl<T: PartialEq + Float> PartialEq for Lab<T>
[src]

fn eq(&self, __arg_0: &Lab<T>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Lab<T>) -> bool

This method tests for !=.

impl<T: Debug + Float> Debug for Lab<T>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<T: Copy + Float> Copy for Lab<T>
[src]

impl<T: Clone + Float> Clone for Lab<T>
[src]

fn clone(&self) -> Lab<T>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<T: Float> Limited for Lab<T>
[src]

fn is_valid(&self) -> bool

Check if the color's components are within the expected ranges.

fn clamp(&self) -> Lab<T>

Return a new color where the components has been clamped to the nearest valid values. Read more

fn clamp_self(&mut self)

Clamp the color's components to the nearest valid values.

impl<T: Float> Mix for Lab<T>
[src]

type Scalar = T

The type of the mixing factor.

fn mix(&self, other: &Lab<T>, factor: T) -> Lab<T>

Mix the color with an other color, by factor. Read more

impl<T: Float> Shade for Lab<T>
[src]

type Scalar = T

The type of the lighten/darken amount.

fn lighten(&self, amount: T) -> Lab<T>

Lighten the color by amount.

fn darken(&self, amount: Self::Scalar) -> Self

Darken the color by amount.

impl<T: Float> GetHue for Lab<T>
[src]

type Hue = LabHue<T>

The kind of hue unit this color space uses. Read more

fn get_hue(&self) -> Option<LabHue<T>>

Calculate a hue if possible. Read more

impl<T: Float> Default for Lab<T>
[src]

fn default() -> Lab<T>

Returns the "default value" for a type. Read more

impl<T: Float> Add<Lab<T>> for Lab<T>
[src]

type Output = Lab<T>

The resulting type after applying the + operator

fn add(self, other: Lab<T>) -> Lab<T>

The method for the + operator

impl<T: Float> Add<T> for Lab<T>
[src]

type Output = Lab<T>

The resulting type after applying the + operator

fn add(self, c: T) -> Lab<T>

The method for the + operator

impl<T: Float> Sub<Lab<T>> for Lab<T>
[src]

type Output = Lab<T>

The resulting type after applying the - operator

fn sub(self, other: Lab<T>) -> Lab<T>

The method for the - operator

impl<T: Float> Sub<T> for Lab<T>
[src]

type Output = Lab<T>

The resulting type after applying the - operator

fn sub(self, c: T) -> Lab<T>

The method for the - operator

impl<T: Float> Mul<Lab<T>> for Lab<T>
[src]

type Output = Lab<T>

The resulting type after applying the * operator

fn mul(self, other: Lab<T>) -> Lab<T>

The method for the * operator

impl<T: Float> Mul<T> for Lab<T>
[src]

type Output = Lab<T>

The resulting type after applying the * operator

fn mul(self, c: T) -> Lab<T>

The method for the * operator

impl<T: Float> Div<Lab<T>> for Lab<T>
[src]

type Output = Lab<T>

The resulting type after applying the / operator

fn div(self, other: Lab<T>) -> Lab<T>

The method for the / operator

impl<T: Float> Div<T> for Lab<T>
[src]

type Output = Lab<T>

The resulting type after applying the / operator

fn div(self, c: T) -> Lab<T>

The method for the / operator

impl<T: Float> From<Color<T>> for Lab<T>
[src]

fn from(color: Color<T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Alpha<Lab<T>, T>> for Lab<T>
[src]

fn from(color: Alpha<Lab<T>, T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Alpha<Rgb<T>, T>> for Lab<T>
[src]

fn from(other: Alpha<Rgb<T>, T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Alpha<Xyz<T>, T>> for Lab<T>
[src]

fn from(other: Alpha<Xyz<T>, T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Alpha<Luma<T>, T>> for Lab<T>
[src]

fn from(other: Alpha<Luma<T>, T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Alpha<Lch<T>, T>> for Lab<T>
[src]

fn from(other: Alpha<Lch<T>, T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Alpha<Hsv<T>, T>> for Lab<T>
[src]

fn from(other: Alpha<Hsv<T>, T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Alpha<Hsl<T>, T>> for Lab<T>
[src]

fn from(other: Alpha<Hsl<T>, T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Alpha<Color<T>, T>> for Lab<T>
[src]

fn from(other: Alpha<Color<T>, T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Xyz<T>> for Lab<T>
[src]

fn from(xyz: Xyz<T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Rgb<T>> for Lab<T>
[src]

fn from(rgb: Rgb<T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Luma<T>> for Lab<T>
[src]

fn from(luma: Luma<T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Lch<T>> for Lab<T>
[src]

fn from(lch: Lch<T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Hsv<T>> for Lab<T>
[src]

fn from(hsv: Hsv<T>) -> Lab<T>

Performs the conversion.

impl<T: Float> From<Hsl<T>> for Lab<T>
[src]

fn from(hsl: Hsl<T>) -> Lab<T>

Performs the conversion.