Good data visualization depends on color maps that step evenly to the eye and encode the structure of the data. This generator builds sequential and diverging color maps by interpolating between endpoints in the perceptual CIELAB space — the same principle behind well-regarded schemes like ColorBrewer — and outputs a clean hex array.
How it works
Each endpoint color is converted from sRGB to CIELAB. The tool then interpolates each L*, a*, and b* channel linearly across the requested number of classes and converts every stop back to sRGB hex. Interpolating in LAB rather than RGB keeps the perceived lightness changing smoothly:
for i in 0..n-1:
t = i / (n - 1)
lab = lerp(startLab, endLab, t) # sequential
rgb = labToRgb(lab)
For a diverging map the ramp is built in two halves — start to midpoint, then midpoint to end — so the neutral color sits exactly in the center class.
Example and tips
A sequential blue map from a pale #f7fbff to a deep #08306b over six classes
gives evenly spaced shades ideal for a population choropleth. For a diverging map
representing change, use orange-to-grey-to-blue rather than red-to-green so the
result stays readable for colorblind viewers. Keep classes between five and seven
for maps; reserve high counts for software-rendered continuous scales.