palette::color_theory

Trait Triadic

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

Represents the triadic color scheme.

A triadic color scheme consists of thee colors at a 120° distance from each other.

Required Methods§

source

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

Return the two additional colors of a triadic color scheme.

The colors are ordered by ascending relative hues, or (hue+120°, hue+240°).

The following example makes a triadic scheme:

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

let primary = Hsl::new_srgb(120.0f32, 0.8, 0.5);
let (triadic1, triadic2) = primary.triadic();

let hues = (
    primary.hue.into_positive_degrees(),
    triadic1.hue.into_positive_degrees(),
    triadic2.hue.into_positive_degrees(),
);

assert_eq!(hues, (120.0, 240.0, 0.0));

Object Safety§

This trait is not object safe.

Implementors§

source§

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