Trait cosmic::cosmic_theme::palette::color_theory::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§
sourcefn tetradic(self) -> (Self, Self, Self)
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.