pub trait Analogous: Sized {
// Required methods
fn analogous(self) -> (Self, Self);
fn analogous_secondary(self) -> (Self, Self);
}
Expand description
Represents the analogous color scheme on a 12 color wheel.
An analogous color scheme consists of three colors next to each other (30° apart) on the color wheel.
Required Methods§
sourcefn analogous(self) -> (Self, Self)
fn analogous(self) -> (Self, Self)
Return the two additional colors of an analogous color scheme.
The colors are ordered by ascending hue difference, or (hue-30°, hue+30°)
. Combined with the input color, these make up 3 adjacent
colors.
The following example makes a 3 color analogous scheme:
use palette::{Hsl, color_theory::Analogous};
let primary = Hsl::new_srgb(120.0f32, 0.8, 0.5);
let (analog_down, analog_up) = primary.analogous();
let hues = (
analog_down.hue.into_positive_degrees(),
primary.hue.into_positive_degrees(),
analog_up.hue.into_positive_degrees(),
);
assert_eq!(hues, (90.0, 120.0, 150.0));
sourcefn analogous_secondary(self) -> (Self, Self)
fn analogous_secondary(self) -> (Self, Self)
Return the next two analogous colors, after the colors analogous
returns.
The colors are ordered by ascending hue difference, or (hue-60°, hue+60°)
. Combined with the input color and the colors from
analogous
, these make up 5 adjacent colors.
The following example makes a 5 color analogous scheme:
use palette::{Hsl, color_theory::Analogous};
let primary = Hsl::new_srgb(120.0f32, 0.8, 0.5);
let (analog_down1, analog_up1) = primary.analogous();
let (analog_down2, analog_up2) = primary.analogous_secondary();
let hues = (
analog_down2.hue.into_positive_degrees(),
analog_down1.hue.into_positive_degrees(),
primary.hue.into_positive_degrees(),
analog_up1.hue.into_positive_degrees(),
analog_up2.hue.into_positive_degrees(),
);
assert_eq!(hues, (60.0, 90.0, 120.0, 150.0, 180.0));
Object Safety§
This trait is not object safe.