Skip to main content

Crate rand_oklch

Crate rand_oklch 

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

OklchColor
Represents a randomly generated oklch() color value.
OklchRange
User-provided Oklch component bounds for random generation.

Enums§

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