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));
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.