Skip to content

labLightnessCluster

labLightnessCluster(colors, lightnessThreshold): number[][]

Defined in: packages/math-color/src/models/lab-lightness-cluster.ts:16

Clusters an array of Lab colors by lightness using agglomerative hierarchical clustering.

Only the L component is used for grouping — hue and chroma are ignored. Intended for achromatic colors where hue is undefined.

LabCoords[]

Lab colors to cluster.

number

Maximum lightness distance to merge two clusters.

number[][]

Array of groups; each group is an array of indices into colors.