Trait palette::SetHue

source ·
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);

Required Methods§

source

fn set_hue(&mut self, hue: H)

Change the hue to a specific value.

Implementations on Foreign Types§

source§

impl<T, H> SetHue<H> for [T]
where T: SetHue<H>, H: Clone,

source§

fn set_hue(&mut self, hue: H)

Implementors§

source§

impl<C, T, H> SetHue<H> for Alpha<C, T>
where C: SetHue<H>,

source§

impl<S, T, H> SetHue<H> for Hsl<S, T>
where H: Into<RgbHue<T>>,

source§

impl<S, T, H> SetHue<H> for Hsv<S, T>
where H: Into<RgbHue<T>>,

source§

impl<S, T, H> SetHue<H> for Hwb<S, T>
where H: Into<RgbHue<T>>,

source§

impl<T, H> SetHue<H> for Cam16Jch<T>
where H: Into<Cam16Hue<T>>,

source§

impl<T, H> SetHue<H> for Cam16Jmh<T>
where H: Into<Cam16Hue<T>>,

source§

impl<T, H> SetHue<H> for Cam16Jsh<T>
where H: Into<Cam16Hue<T>>,

source§

impl<T, H> SetHue<H> for Cam16Qch<T>
where H: Into<Cam16Hue<T>>,

source§

impl<T, H> SetHue<H> for Cam16Qmh<T>
where H: Into<Cam16Hue<T>>,

source§

impl<T, H> SetHue<H> for Cam16Qsh<T>
where H: Into<Cam16Hue<T>>,

source§

impl<T, H> SetHue<H> for Cam16UcsJmh<T>
where H: Into<Cam16Hue<T>>,

source§

impl<T, H> SetHue<H> for Okhsl<T>
where H: Into<OklabHue<T>>,

source§

impl<T, H> SetHue<H> for Okhsv<T>
where H: Into<OklabHue<T>>,

source§

impl<T, H> SetHue<H> for Okhwb<T>
where H: Into<OklabHue<T>>,

source§

impl<T, H> SetHue<H> for Oklch<T>
where H: Into<OklabHue<T>>,

source§

impl<Wp, T, H> SetHue<H> for Hsluv<Wp, T>
where H: Into<LuvHue<T>>,

source§

impl<Wp, T, H> SetHue<H> for Lch<Wp, T>
where H: Into<LabHue<T>>,

source§

impl<Wp, T, H> SetHue<H> for Lchuv<Wp, T>
where H: Into<LuvHue<T>>,