Trait cosmic::cosmic_theme::palette::MixAssign
source · pub trait MixAssign {
type Scalar;
// Required method
fn mix_assign(&mut self, other: Self, factor: Self::Scalar);
}
Expand description
Assigning linear color interpolation of two colors.
See also Mix
.
use approx::assert_relative_eq;
use palette::{LinSrgb, MixAssign};
let mut a = LinSrgb::new(0.0, 0.5, 1.0);
let b = LinSrgb::new(1.0, 0.5, 0.0);
a.mix_assign(b, 0.5);
assert_relative_eq!(a, LinSrgb::new(0.5, 0.5, 0.5));
Required Associated Types§
Required Methods§
sourcefn mix_assign(&mut self, other: Self, factor: Self::Scalar)
fn mix_assign(&mut self, other: Self, factor: Self::Scalar)
Mix the color with an other color, by factor
.
factor
should be between 0.0
and 1.0
, where 0.0
will result in
the same color as self
and 1.0
will result in the same color as
other
.
Object Safety§
This trait is not object safe.