Trait palette::Shade [] [src]

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::{Rgb, Shade};

let a = Rgb::new(0.4, 0.4, 0.4);
let b = Rgb::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.

Required Methods

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

Lighten the color by amount.

Provided Methods

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

Darken the color by amount.

Implementors