Struct palette::Lch [] [src]

pub struct Lch<T: Float = f32> {
    pub l: T,
    pub chroma: T,
    pub hue: LabHue<T>,
}

CIE L*C*h°, a polar version of CIE L*a*b*.

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

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

chroma: T

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<T>

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

Methods

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

fn new(l: T, chroma: T, hue: LabHue<T>) -> Lch<T>

CIE L*C*h°.

Trait Implementations

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

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

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

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

This method tests for !=.

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

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

Formats the value using the given formatter.

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

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

fn clone(&self) -> Lch<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 Lch<T>
[src]

fn is_valid(&self) -> bool

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

fn clamp(&self) -> Lch<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 Lch<T>
[src]

type Scalar = T

The type of the mixing factor.

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

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

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

type Scalar = T

The type of the lighten/darken amount.

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

Lighten the color by amount.

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

Darken the color by amount.

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

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

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

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

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

impl<T: Float> Saturate for Lch<T>
[src]

type Scalar = T

The type of the (de)saturation factor.

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

Increase the saturation by factor.

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

Decrease the saturation by factor.

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

fn default() -> Lch<T>

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

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

type Output = Lch<T>

The resulting type after applying the + operator

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

The method for the + operator

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

type Output = Lch<T>

The resulting type after applying the + operator

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

The method for the + operator

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

type Output = Lch<T>

The resulting type after applying the - operator

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

The method for the - operator

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

type Output = Lch<T>

The resulting type after applying the - operator

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

The method for the - operator

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.

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

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

Performs the conversion.