Skip to content
party.js logoparty.js logo

ReferenceSamplersFunction

randomHue()

Picks colors with a random hue.

function randomHue(options: RandomHueOptions): SamplerFn<Color>;

Creates a sampler for colors of the same lightness and intensity, with a random hue.

Because Oklch is perceptually uniform, all hues come out equally bright, which makes for even, rainbow-like mixes.

optionsRandomHueOptions

The lightness, chroma and opacity shared by all colors.

PartyJSError

If the supplied chroma is negative.

const color = randomHue({ l: 0.7, c: 0.15 });