Expand description
Generate random Oklch color values with configurable component 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_oklch::random_oklch;
let color = random_oklch();
assert!((0.0..=360.0).contains(&color.hue));
assert!(color.to_oklch_string().starts_with("oklch("));Structs§
- Oklch
Color - Represents a randomly generated
oklch()color value. - Oklch
Range - User-provided Oklch component bounds for random generation.
Enums§
- Oklch
Error - Error returned when Oklch bounds are invalid.
Functions§
- random_
oklch - Generates a random Oklch color using default bounds.
- random_
oklch_ in - Generates a random Oklch color using custom bounds.
- random_
oklch_ in_ with_ rng - Generates a random Oklch color using custom bounds and a caller-provided RNG.
- random_
oklch_ with_ rng - Generates a random Oklch color using default bounds and a caller-provided RNG.