Struct color_conv::hsl::Hsl [−][src]
A representation of the HSL (cyan, magenta, yellow, key) color format.
Fields
hue: u16
Hue value (in degrees)
saturation: u8
Saturation percentage
lightness: u8
Lightness percentage
Implementations
impl Hsl
[src]
pub fn new(hue: u16, saturation: u8, lightness: u8) -> Result<Self, Error>
[src]
Returns a Result containing a new Hsl object given hue, saturation,
and lightness values. Will return an Error
if either the saturation
or lightness are larger than 100 due to the fact that they represent
percentages or the hue is greater than 360 because it represents a
degree value.
Arguments
hue
- the hue value of the colorsaturation
- the saturation value of the colorlightness
- the lightness value of the color
Examples
use color_conv::Hsl; let cyan = Hsl::new(180, 100, 50)?;
pub fn new_unchecked(hue: u16, saturation: u8, lightness: u8) -> Self
[src]
Trait Implementations
impl Clone for Hsl
[src]
impl Color for Hsl
[src]
fn to_rgb(self) -> Rgb
[src]
fn to_cmyk(self) -> Cmyk
[src]
fn to_hex_string(self) -> String
[src]
fn to_hsl(self) -> Hsl
[src]
impl Copy for Hsl
[src]
impl Debug for Hsl
[src]
impl Display for Hsl
[src]
impl Eq for Hsl
[src]
impl Hash for Hsl
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Hsl> for Hsl
[src]
impl StructuralEq for Hsl
[src]
impl StructuralPartialEq for Hsl
[src]
Auto Trait Implementations
impl RefUnwindSafe for Hsl
impl Send for Hsl
impl Sync for Hsl
impl Unpin for Hsl
impl UnwindSafe for Hsl
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,