Struct palette::Lch [] [src]

pub struct Lch {
    pub l: f32,
    pub chroma: f32,
    pub hue: LabHue,
    pub alpha: f32,
}

CIE L*C*h°, a polar version of CIE L*a*b*, with an alpha component.

L*C*h° shares its range and perceptual uniformity with L*a*b*, but it's a cylindrical color space, like HSL and HSV. This gives it the same ability to directly change the hue and colorfulness of a color, while preserving other visual aspects.

Fields

l: f32

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

chroma: f32

C* is the colorfulness of the color. It's similar to saturation. 0.0 gives gray scale colors, and numbers around 1.0-1.41421356 gives fully saturated colors. The upper limit of 1.41421356 (or sqrt(2.0)) should include the whole L*a*b* space and some more.

hue: LabHue

The hue of the color, in degrees. Decides if it's red, blue, purple, etc.

alpha: f32

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

Methods

impl Lch
[src]

fn lch(l: f32, chroma: f32, hue: LabHue) -> Lch

CIE L*C*h°.

fn lcha(l: f32, chroma: f32, hue: LabHue, alpha: f32) -> Lch

CIE L*C*h° and transparency.

Trait Implementations

impl PartialEq for Lch
[src]

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

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

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

This method tests for !=.

impl Debug for Lch
[src]

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

Formats the value using the given formatter.

impl Copy for Lch
[src]

impl Clone for Lch
[src]

fn clone(&self) -> Lch

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 Lch
[src]

fn is_valid(&self) -> bool

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

fn clamp(&self) -> Lch

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 Lch
[src]

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

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

impl Shade for Lch
[src]

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

Lighten the color by amount.

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

Darken the color by amount.

impl GetHue for Lch
[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 Hue for Lch
[src]

fn with_hue(&self, hue: LabHue) -> Lch

Return a new copy of self, but with a specific hue.

fn shift_hue(&self, amount: LabHue) -> Lch

Return a new copy of self, but with the hue shifted by amount.

impl Saturate for Lch
[src]

fn saturate(&self, factor: f32) -> Lch

Increase the saturation by factor.

fn desaturate(&self, factor: f32) -> Self

Decrease the saturation by factor.

impl Default for Lch
[src]

fn default() -> Lch

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

impl Add<Lch> for Lch
[src]

type Output = Lch

The resulting type after applying the + operator

fn add(self, other: Lch) -> Lch

The method for the + operator

impl Add<f32> for Lch
[src]

type Output = Lch

The resulting type after applying the + operator

fn add(self, c: f32) -> Lch

The method for the + operator

impl Sub<Lch> for Lch
[src]

type Output = Lch

The resulting type after applying the - operator

fn sub(self, other: Lch) -> Lch

The method for the - operator

impl Sub<f32> for Lch
[src]

type Output = Lch

The resulting type after applying the - operator

fn sub(self, c: f32) -> Lch

The method for the - operator

impl From<Color> for Lch
[src]

fn from(color: Color) -> Lch

Performs the conversion.

impl From<Lab> for Lch
[src]

fn from(lab: Lab) -> Lch

Performs the conversion.

impl From<Rgb> for Lch
[src]

fn from(rgb: Rgb) -> Lch

Performs the conversion.

impl From<Luma> for Lch
[src]

fn from(luma: Luma) -> Lch

Performs the conversion.

impl From<Xyz> for Lch
[src]

fn from(xyz: Xyz) -> Lch

Performs the conversion.

impl From<Hsv> for Lch
[src]

fn from(hsv: Hsv) -> Lch

Performs the conversion.

impl From<Hsl> for Lch
[src]

fn from(hsl: Hsl) -> Lch

Performs the conversion.