Trait nannou::color::Shade

source ·
pub trait Shade: Sized {
    type Scalar: Float;

    // Required method
    fn lighten(&self, amount: Self::Scalar) -> Self;

    // Provided method
    fn darken(&self, amount: Self::Scalar) -> Self { ... }
}
Expand description

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));

Required Associated Types§

source

type Scalar: Float

The type of the lighten/darken amount.

Required Methods§

source

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

Lighten the color by amount.

Provided Methods§

source

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

Darken the color by amount.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<C> Shade for Alpha<C, <C as Shade>::Scalar>
where C: Shade,

§

type Scalar = <C as Shade>::Scalar

source§

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

§

type Scalar = T

source§

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

§

type Scalar = T

source§

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

§

type Scalar = T

source§

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

§

type Scalar = T

source§

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

§

type Scalar = T

source§

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

§

type Scalar = T

source§

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

§

type Scalar = T

source§

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

§

type Scalar = T

source§

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

§

type Scalar = T