cosmic::cosmic_theme::palette

Trait Mix

source
pub trait Mix {
    type Scalar;

    // Required method
    fn mix(self, other: Self, factor: Self::Scalar) -> Self;
}
Expand description

Linear color interpolation of two colors.

See also MixAssign.

use approx::assert_relative_eq;
use palette::{LinSrgb, Mix};

let a = LinSrgb::new(0.0, 0.5, 1.0);
let b = LinSrgb::new(1.0, 0.5, 0.0);

assert_relative_eq!(a.mix(b, 0.0), a);
assert_relative_eq!(a.mix(b, 0.5), LinSrgb::new(0.5, 0.5, 0.5));
assert_relative_eq!(a.mix(b, 1.0), b);

Required Associated Types§

source

type Scalar

The type of the mixing factor.

Required Methods§

source

fn mix(self, other: Self, factor: Self::Scalar) -> Self

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.

Implementors§

source§

impl<C> Mix for Alpha<C, <C as Mix>::Scalar>
where C: Mix, <C as Mix>::Scalar: Zero + One + Clamp + Arithmetics + Clone,

source§

type Scalar = <C as Mix>::Scalar

source§

impl<C, T> Mix for PreAlpha<C>
where C: Mix<Scalar = T> + Premultiply<Scalar = T>, T: Real + Zero + One + Clamp + Arithmetics + Clone,

source§

impl<S, T> Mix for Luma<S, T>
where T: Real + Zero + One + Arithmetics + Clamp + Clone,

source§

impl<S, T> Mix for Rgb<S, T>
where T: Real + Zero + One + Arithmetics + Clamp + Clone,

source§

impl<S, T> Mix for Hsl<S, T>

source§

impl<S, T> Mix for Hsv<S, T>

source§

impl<S, T> Mix for Hwb<S, T>

source§

impl<T> Mix for Cam16Jch<T>

source§

impl<T> Mix for Cam16Jmh<T>

source§

impl<T> Mix for Cam16Jsh<T>

source§

impl<T> Mix for Cam16Qch<T>

source§

impl<T> Mix for Cam16Qmh<T>

source§

impl<T> Mix for Cam16Qsh<T>

source§

impl<T> Mix for Cam16UcsJab<T>
where T: Real + Zero + One + Arithmetics + Clamp + Clone,

source§

impl<T> Mix for Cam16UcsJmh<T>

source§

impl<T> Mix for Okhsl<T>

source§

impl<T> Mix for Okhsv<T>

source§

impl<T> Mix for Okhwb<T>

source§

impl<T> Mix for Oklab<T>
where T: Real + Zero + One + Arithmetics + Clamp + Clone,

source§

impl<T> Mix for Oklch<T>

source§

impl<Wp, T> Mix for Hsluv<Wp, T>

source§

impl<Wp, T> Mix for Lab<Wp, T>
where T: Real + Zero + One + Arithmetics + Clamp + Clone,

source§

impl<Wp, T> Mix for Lch<Wp, T>

source§

impl<Wp, T> Mix for Lchuv<Wp, T>

source§

impl<Wp, T> Mix for Luv<Wp, T>
where T: Real + Zero + One + Arithmetics + Clamp + Clone,

source§

impl<Wp, T> Mix for Xyz<Wp, T>
where T: Real + Zero + One + Arithmetics + Clamp + Clone,

source§

impl<Wp, T> Mix for Yxy<Wp, T>
where T: Real + Zero + One + Arithmetics + Clamp + Clone,