Skip to main content

Function: createQualitativeScale()

createQualitativeScale(numberOfColors): Color[]

Creates a qualitative color scale.

This function generates a set of distinct colors that are easily distinguishable from each other, which is useful for representing categorical data.

Parameters​

ParameterTypeDescription
numberOfColorsnumberThe number of distinct colors to generate.

Returns​

Color[]

An array of distinct Color objects.

Example​

const categoricalColors = createQualitativeScale(5);
// Returns an array of 5 distinct Color objects

Defined in​

scales/components/qualitative-scale.ts:18