Skip to main content

Crate rand_hsv

Crate rand_hsv 

Source
Expand description

Generate random HSV/HSVA 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.

The formatted hsva(...) output is a stable crate compatibility format; it is not intended to imply broad browser CSS support.

§Examples

use rand_hsv::random_hsv;

let color = random_hsv();

assert!((0.0..=360.0).contains(&color.hue));
assert!(color.to_hsva_string().starts_with("hsva("));

Structs§

HsvColor
Represents a randomly generated hsva() color value.
HsvRange
User-provided HSV channel bounds for random generation.

Enums§

HsvError
Error returned when HSV bounds are invalid.

Functions§

random_hsv
Generates a random HSV color using default bounds.
random_hsv_in
Generates a random HSV color using custom bounds.
random_hsv_in_with_rng
Generates a random HSV color using custom bounds and a caller-provided RNG.
random_hsv_with_rng
Generates a random HSV color using default bounds and a caller-provided RNG.