Skip to main content

Crate rand_hsl

Crate rand_hsl 

Source
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.