Struct palette::Lab [] [src]

pub struct Lab {
    pub l: f32,
    pub a: f32,
    pub b: f32,
    pub alpha: f32,
}

The CIE L*a*b* (CIELAB) color space with an alpha component.

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: f32

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

a: f32

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

b: f32

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

alpha: f32

The transparency of the color. 0.0 is completely transparent and 1.0 is completely opaque.

Methods

impl Lab
[src]

fn lab(l: f32, a: f32, b: f32) -> Lab

CIE L*a*b*.

fn laba(l: f32, a: f32, b: f32, alpha: f32) -> Lab

CIE L*a*b* and transparency.

Trait Implementations

impl PartialEq for Lab
[src]

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

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

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

This method tests for !=.

impl Debug for Lab
[src]

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

Formats the value using the given formatter.

impl Copy for Lab
[src]

impl Clone for Lab
[src]

fn clone(&self) -> Lab

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 ColorSpace for Lab
[src]

fn is_valid(&self) -> bool

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

fn clamp(&self) -> Lab

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 Mix for Lab
[src]

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

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

impl Shade for Lab
[src]

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

Lighten the color by amount.

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

Darken the color by amount.

impl GetHue for Lab
[src]

type Hue = LabHue

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

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

Calculate a hue if possible. Read more

impl Default for Lab
[src]

fn default() -> Lab

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

impl From<Color> for Lab
[src]

fn from(color: Color) -> Lab

Performs the conversion.

impl From<Xyz> for Lab
[src]

fn from(xyz: Xyz) -> Lab

Performs the conversion.

impl From<Rgb> for Lab
[src]

fn from(rgb: Rgb) -> Lab

Performs the conversion.

impl From<Luma> for Lab
[src]

fn from(luma: Luma) -> Lab

Performs the conversion.

impl From<Lch> for Lab
[src]

fn from(lch: Lch) -> Lab

Performs the conversion.

impl From<Hsv> for Lab
[src]

fn from(hsv: Hsv) -> Lab

Performs the conversion.

impl From<Hsl> for Lab
[src]

fn from(hsl: Hsl) -> Lab

Performs the conversion.