cosmic::cosmic_theme::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));

Object Safety§

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
where T: ShiftHue, <T as ShiftHue>::Scalar: HalfRotation,

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,