palette::color_theory

Trait Complementary

Source
pub trait Complementary: Sized {
    // Required method
    fn complementary(self) -> Self;
}
Expand description

Represents the complementary color scheme.

A complementary color scheme consists of two colors on the opposite sides of the color wheel.

Required Methods§

Source

fn complementary(self) -> Self

Return the complementary color of self.

This is the same as if the hue of self would be rotated by 180°.

The following example makes a complementary color pair:

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

let primary = Hsl::new_srgb(120.0f32, 8.0, 0.5);
let complementary = primary.complementary();

let hues = (
    primary.hue.into_positive_degrees(),
    complementary.hue.into_positive_degrees(),
);

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Complementary for Cam16UcsJab<T>
where T: Neg<Output = T>,

Source§

impl<T> Complementary for Oklab<T>
where T: Neg<Output = T>,

Source§

impl<T> Complementary for T

Source§

impl<T, A> Complementary for Alpha<Cam16UcsJab<T>, A>

Source§

impl<T, A> Complementary for Alpha<Oklab<T>, A>
where Oklab<T>: Complementary,

Source§

impl<Wp, T> Complementary for Lab<Wp, T>
where T: Neg<Output = T>,

Source§

impl<Wp, T> Complementary for Luv<Wp, T>
where T: Neg<Output = T>,

Source§

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

Source§

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