cosmic::cosmic_theme::palette::color_theory

Trait Tetradic

source
pub trait Tetradic: Sized {
    // Required method
    fn tetradic(self) -> (Self, Self, Self);
}
Expand description

Represents the tetradic, or square, color scheme.

A tetradic color scheme consists of four colors at a 90° distance from each other. These form two pairs of complementary colors.

Required Methods§

source

fn tetradic(self) -> (Self, Self, Self)

Return the three additional colors of a tetradic color scheme.

The colors are ordered by ascending relative hues, or (hue+90°, hue+180°, hue+270°).

The following example makes a tetradic scheme:

use palette::{Hsl, color_theory::Tetradic};

let primary = Hsl::new_srgb(120.0f32, 0.8, 0.5);
let (tetradic1, tetradic2, tetradic3) = primary.tetradic();

let hues = (
    primary.hue.into_positive_degrees(),
    tetradic1.hue.into_positive_degrees(),
    tetradic2.hue.into_positive_degrees(),
    tetradic3.hue.into_positive_degrees(),
);

assert_eq!(hues, (120.0, 210.0, 300.0, 30.0));

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> Tetradic for Cam16UcsJab<T>
where T: Neg<Output = T> + Clone,

source§

impl<T> Tetradic for Oklab<T>
where T: Neg<Output = T> + Clone,

source§

impl<T> Tetradic for T
where T: ShiftHue + Clone, <T as ShiftHue>::Scalar: Real,

source§

impl<T, A> Tetradic for Alpha<Cam16UcsJab<T>, A>
where Cam16UcsJab<T>: Tetradic, A: Clone,

source§

impl<T, A> Tetradic for Alpha<Oklab<T>, A>
where Oklab<T>: Tetradic, A: Clone,

source§

impl<Wp, T> Tetradic for Lab<Wp, T>
where T: Neg<Output = T> + Clone,

source§

impl<Wp, T> Tetradic for Luv<Wp, T>
where T: Neg<Output = T> + Clone,

source§

impl<Wp, T, A> Tetradic for Alpha<Lab<Wp, T>, A>
where Lab<Wp, T>: Tetradic, A: Clone,

source§

impl<Wp, T, A> Tetradic for Alpha<Luv<Wp, T>, A>
where Luv<Wp, T>: Tetradic, A: Clone,