Function css_colors::hsl

source ·
pub fn hsl(h: i32, s: u8, l: u8) -> HSL
Expand description

Constructs a HSL Color from numerical values, similar to the hsl function in CSS.

The hue component is expressed in degrees. Values outside of the 0-359° range will be normalized accordingly. The saturation and lightness components are expressed in percentages. Values outside of the 0-100% range will cause a panic.

Example

use css_colors::{Color, hsl};

let salmon = hsl(6, 93, 71);

assert_eq!(salmon.to_css(), "hsl(6, 93%, 71%)");