Trait ChangeColors

Source
pub trait ChangeColors {
    // Required methods
    fn with_saturate(&self, amount: f32) -> Self;
    fn with_brightness(&self, amount: f32) -> Self;

    // Provided methods
    fn saturate(&self) -> Self
       where Self: Sized { ... }
    fn desaturate(&self) -> Self
       where Self: Sized { ... }
    fn lighten(&self) -> Self
       where Self: Sized { ... }
    fn darken(&self) -> Self
       where Self: Sized { ... }
}

Required Methods§

Source

fn with_saturate(&self, amount: f32) -> Self

De/saturate color by percentage Negative amount increases saturation So -0.1 is 10% more saturated

Source

fn with_brightness(&self, amount: f32) -> Self

Change brightness to amount So 1.1 is 10% brighter

Provided Methods§

Source

fn saturate(&self) -> Self
where Self: Sized,

Increase saturation by 10%

Source

fn desaturate(&self) -> Self
where Self: Sized,

Decrease saturation by 10%

Source

fn lighten(&self) -> Self
where Self: Sized,

Source

fn darken(&self) -> Self
where Self: Sized,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ChangeColors for Vec<Color>

Source§

fn with_saturate(&self, amount: f32) -> Vec<Color>

Source§

fn with_brightness(&self, amount: f32) -> Vec<Color>

Implementors§