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§
sourcefn complementary(self) -> Self
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.