Function css_colors::hsla

source ·
pub fn hsla(h: i32, s: u8, l: u8, a: f32) -> HSLA
Expand description

Constructs a HSLA Color from numerical values, similar to the hsla 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. The alpha value is expressed as a float. Values outside of the 0.0-1.0 range will cause a panic.

Example

use css_colors::{Color, hsla};

let salmon = hsla(6, 93, 71, 0.50);

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