Skip to content

Colors: util to generate colors which allow to differentiate colors well

Goal: Avoid similar colors. The current approach is not that good (see #335).

Approach: Calculate colors for a list of items and maximize deltaE. Select colors randomly, measure deltaE to each existing color and assure that deltaE is larger than a fixed value. Return css-lab() colors.

Clamp colorspace to sRGB.

Accessibility Consideration: Avoid Red/green with similar abs(a). E.g. a color with a=-100 possibly does not pair well with a color with a=100. This would result in a modified deltaE like this: deltaE = sqrt((L_2-L_1)^2+(abs(a_2)-abs(a_1))^2 + (b_2-b_1)^2)

Edited by Janis Streib
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information