Trait nannou::color::Saturate[][src]

pub trait Saturate {
    type Scalar: Float;
    pub fn saturate(&self, factor: Self::Scalar) -> Self;

    pub fn desaturate(&self, factor: Self::Scalar) -> Self { ... }
}

A trait for colors where the saturation (or chroma) can be manipulated without conversion.

use palette::{Hsv, Saturate};

let a = Hsv::new(0.0, 0.25, 1.0);
let b = Hsv::new(0.0, 1.0, 1.0);

assert_eq!(a.saturate(1.0), b.desaturate(0.5));

Associated Types

type Scalar: Float[src]

The type of the (de)saturation factor.

Loading content...

Required methods

pub fn saturate(&self, factor: Self::Scalar) -> Self[src]

Increase the saturation by factor.

Loading content...

Provided methods

pub fn desaturate(&self, factor: Self::Scalar) -> Self[src]

Decrease the saturation by factor.

Loading content...

Implementors

impl<C> Saturate for Alpha<C, <C as Saturate>::Scalar> where
    C: Saturate
[src]

type Scalar = <C as Saturate>::Scalar

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

type Scalar = T

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

type Scalar = T

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

type Scalar = T

Loading content...