palette::color_theory

Trait SplitComplementary

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

Represents the split complementary color scheme.

A split complementary color scheme consists of three colors, where the second and third are adjacent to (30° away from) the complementary color of the first.

Required Methods§

source

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

Return the two split complementary colors of self.

The colors are ordered by ascending hue, or (hue+150°, hue+210°). Combined with the input color, these make up 3 adjacent colors.

The following example makes a split complementary color scheme:

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

let primary = Hsl::new_srgb(120.0f32, 8.0, 0.5);
let (complementary1, complementary2) = primary.split_complementary();

let hues = (
    primary.hue.into_positive_degrees(),
    complementary1.hue.into_positive_degrees(),
    complementary2.hue.into_positive_degrees(),
);

assert_eq!(hues, (120.0, 270.0, 330.0));

Object Safety§

This trait is not object safe.

Implementors§

source§

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