[][src]Trait palette::Shade

pub trait Shade: Sized {
    type Scalar: Float;
    fn lighten(&self, amount: Self::Scalar) -> Self;

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

The Shade trait allows a color to be lightened or darkened.

use palette::{LinSrgb, Shade};

let a = LinSrgb::new(0.4, 0.4, 0.4);
let b = LinSrgb::new(0.6, 0.6, 0.6);

assert_eq!(a.lighten(0.1), b.darken(0.1));

Associated Types

type Scalar: Float

The type of the lighten/darken amount.

Loading content...

Required methods

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

Lighten the color by amount.

Loading content...

Provided methods

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

Darken the color by amount.

Loading content...

Implementors

impl<C: Shade> Shade for Alpha<C, C::Scalar>[src]

type Scalar = C::Scalar

impl<S, T> Shade for Luma<S, T> where
    T: Component + Float,
    S: LumaStandard<TransferFn = LinearFn>, 
[src]

type Scalar = T

impl<S, T> Shade for Rgb<S, T> where
    S: RgbStandard<TransferFn = LinearFn>,
    T: Component + Float
[src]

type Scalar = T

impl<S, T> Shade for Hsl<S, T> where
    T: Component + Float,
    S: RgbSpace
[src]

type Scalar = T

impl<S, T> Shade for Hsv<S, T> where
    T: Component + Float,
    S: RgbSpace
[src]

type Scalar = T

impl<S, T> Shade for Hwb<S, T> where
    T: Component + Float,
    S: RgbSpace
[src]

type Scalar = T

impl<Wp, T> Shade for Lab<Wp, T> where
    T: Component + Float,
    Wp: WhitePoint
[src]

type Scalar = T

impl<Wp, T> Shade for Lch<Wp, T> where
    T: Component + Float,
    Wp: WhitePoint
[src]

type Scalar = T

impl<Wp, T> Shade for Xyz<Wp, T> where
    T: Component + Float,
    Wp: WhitePoint
[src]

type Scalar = T

impl<Wp, T> Shade for Yxy<Wp, T> where
    T: Component + Float,
    Wp: WhitePoint
[src]

type Scalar = T

Loading content...