zng::color

Function hsl

source
pub fn hsl<H, N>(hue: H, saturation: N, lightness: N) -> Hsla
where H: Into<AngleDegree>, N: Into<Factor>,
Expand description

HSL color, opaque, alpha is set to 1.0.

§Arguments

The first argument hue can be any angle unit. The other two arguments can be f32 in the 0.0..=1.0 range or a percentage.

The saturation and lightness arguments must be of the same type.

§Examples

use zng_color::hsl;
use zng_layout::unit::*;

let red = hsl(0.deg(), 100.pct(), 50.pct());
let green = hsl(115.deg(), 1.0, 0.5);