pub trait SetHue<H> {
// Required method
fn set_hue(&mut self, hue: H);
}
Expand description
Change the hue of a color to a specific value without moving.
See also WithHue
, GetHue
, ShiftHue
and ShiftHueAssign
.
use palette::{Hsl, SetHue};
let mut color = Hsl::new_srgb(120.0, 1.0, 0.5);
color.set_hue(240.0);
assert_eq!(color, Hsl::new_srgb(240.0, 1.0, 0.5));
SetHue
is also implemented for [T]
:
use palette::{Hsl, SetHue};
let mut my_vec = vec![Hsl::new_srgb(104.0, 0.3, 0.8), Hsl::new_srgb(113.0, 0.5, 0.8)];
let mut my_array = [Hsl::new_srgb(104.0, 0.3, 0.8), Hsl::new_srgb(113.0, 0.5, 0.8)];
let mut my_slice = &mut [Hsl::new_srgb(104.0, 0.3, 0.8), Hsl::new_srgb(112.0, 0.5, 0.8)];
my_vec.set_hue(120.0);
my_array.set_hue(120.0);
my_slice.set_hue(120.0);