Expand description
Generate random HSL/HSLA color values with configurable channel bounds.
The crate samples each component independently from the configured numeric ranges. It does not attempt palette design, gamut mapping, contrast checking, or perceptual-uniform sampling.
§Examples
use rand_hsl::random_hsl;
let color = random_hsl();
assert!((0.0..=360.0).contains(&color.hue));
assert!(color.to_hsla_string().starts_with("hsla("));Structs§
- HslColor
- Represents a randomly generated
hsla()color value. - HslRange
- User-provided HSL channel bounds for random generation.
Enums§
- HslError
- Error returned when HSL bounds are invalid.
Functions§
- random_
hsl - Generates a random HSL color using default bounds.
- random_
hsl_ in - Generates a random HSL color using custom bounds.
- random_
hsl_ in_ with_ rng - Generates a random HSL color using custom bounds and a caller-provided RNG.
- random_
hsl_ with_ rng - Generates a random HSL color with a caller-provided RNG.