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§
Sourcefn with_saturate(&self, amount: f32) -> Self
fn with_saturate(&self, amount: f32) -> Self
De/saturate color by percentage
Negative amount increases saturation
So -0.1
is 10% more saturated
Sourcefn with_brightness(&self, amount: f32) -> Self
fn with_brightness(&self, amount: f32) -> Self
Change brightness to amount
So 1.1
is 10% brighter
Provided Methods§
Sourcefn desaturate(&self) -> Selfwhere
Self: Sized,
fn desaturate(&self) -> Selfwhere
Self: Sized,
Decrease saturation by 10%
fn lighten(&self) -> Selfwhere
Self: Sized,
fn darken(&self) -> Selfwhere
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.