Random CIELAB Color Generator
Generate a CIELAB D50 tuple with lightness in [0, 100) and a/b axes in [-128, 128) using injected randomness; the tuple is not clipped to a device gamut.
Description
Sample CIELAB D50 lightness and signed a/b coordinates within fixed independent ranges.
CIELAB separates lightness from the signed a and b color-opponent axes. CSS lab() uses the D50 reference white, distinguishing this representation from raw RGB channels.1
The output lightness ranges from zero toward 100; a and b each range from −128 toward 128. This is a sampling box rather than the set of displayable sRGB colors.
When to use Random CIELAB Color Generator
Use it for CIE color-coordinate fixtures or studies where out-of-gamut coordinates are permitted.
How to use Random CIELAB Color Generator and understand its results
- Run without input fields, using {} programmatically.
- Read lightness on the 0–100 scale and preserve the signed a and b coordinates.
- Format the example as CSS lab(25% -64 -64), or convert under the intended white-point and gamut convention before displaying it.
lightness = 100 × r1; a = −128 + 256 × r2; b = −128 + 256 × r3 Three finite draws in [0, 1) independently select the coordinates.
The implementation returns numbers directly without converting from RGB, clipping to gamut, performing chromatic adaptation, or generating a CSS string. Coordinate-uniform sampling is not uniform over displayable colors.
{
"input": {},
"randomDraw": 0.25,
"output": {
"lightness": 25,
"a": -64,
"b": -64
}
} Lightness zero and negative a/b endpoints are permitted. Positive upper bounds are approached but not intentionally included.
Floating-point rounding applies near endpoints. An invalid draw in any coordinate fails instead of being clamped.
Limitations and assumptions
The default source is Math.random; no seed input or cryptographic entropy guarantee is provided. Repeated runs may select the same result, and the distribution depends on the random source.
There is no device-gamut, accessibility, perceptual-spacing, printing, or palette-harmony guarantee. Lightness alone does not determine foreground/background contrast.
CIELAB is not OKLab; their coordinate scales and color-space definitions differ.
Alternative or Complementary methods
Choose the companion coordinate representation when needed, observing its conversion formulas. RGB generation provides directly bounded byte channels for another fixture convention.
References
-
CSS Color Module Level 4 — World Wide Web Consortium
Similar or alternative tools
- Random CIELCH Color Generator
Sample the companion CIE representation under D50.
- Random RGB Color Generator
Generate three integer sRGB byte channels.