Expand description
Generate random RGB/RGBA color values with configurable channel bounds.
The crate samples each channel independently from the configured numeric ranges. It does not attempt palette design, gamut mapping, contrast checking, or perceptual-uniform sampling.
§Examples
use rand_rgb::random_color;
let color = random_color();
assert!((0.0..=1.0).contains(&color.alpha));
assert!(color.to_rgba_string().starts_with("rgba("));Structs§
- Color
Range - User-provided channel bounds for random generation.
- Random
Color - Represents a randomly generated
rgba()color value.
Enums§
- Color
Error - Error returned when color bounds are invalid.
Functions§
- random_
color - Generates a random color using default bounds.
- random_
color_ in - Generates a random color using custom bounds.
- random_
color_ in_ with_ rng - Generates a random color using custom bounds and a caller-provided RNG.
- random_
color_ with_ rng - Generates a random color using default bounds and a caller-provided RNG.