macro_rules! hsl {
($gray:expr) => { ... };
($gray:expr, $a:expr$(,)?) => { ... };
($h:expr, $s:expr, $l:expr$(,)?) => { ... };
($h:expr, $s:expr, $l:expr, $a:expr$(,)?) => { ... };
}Expand description
Constructs a Color with hue, saturation, lightness and optional alpha.
ยงExamples
let c = hsl!(50.0); // Gray
assert_eq!(c.channels(), [128, 128, 128, 255]);
let c = hsl!(50.0, 0.5); // Gray with alpha
assert_eq!(c.channels(), [128, 128, 128, 128]);
let c = hsl!(342.0, 100.0, 80.0); // Hue, Saturation, Lightness
assert_eq!(c.channels(), [255, 153, 184, 255]);
let c = hsl!(342.0, 100.0, 80.0, 0.5); // Hue, Saturation, Lightness, Alpha
assert_eq!(c.channels(), [255, 153, 184, 128]);