Color Steps Generator
Generate smooth color palettes between two colors with perceptually uniform interpolation in RGB, HSL, LAB, or LCH color spaces.
About
Naive linear interpolation in sRGB produces muddy midtones and perceptual jumps. A 5-step gradient from blue to yellow through RGB passes through an undesirable grey. This tool interpolates in four color spaces - sRGB, HSL, CIELAB, and CIE LCH - so you control whether steps are mathematically even or perceptually uniform. CIELAB uses the CIE 1976 L*a*b* model calibrated to human vision with D65 illuminant, meaning equal numeric distance corresponds to equal perceived difference (ΔE ≈ constant). LCH adds hue-preserving polar interpolation. Wrong color space selection in UI/brand work causes inconsistent ramps that fail WCAG contrast checks mid-palette. This tool calculates relative luminance per step and displays the WCAG contrast ratio against white and black so you can audit accessibility inline.
Results export as HEX, rgb, or hsl strings ready for CSS variables or design tokens. The tool approximates perceptual uniformity assuming a standard D65 observer. Slight discrepancies arise on wide-gamut displays (P3) since all math is clamped to sRGB gamut. Pro tip: for smooth hue transitions (e.g., rainbow ramps), use LCH. For value/shade ramps of a single hue, LAB is optimal.
Formulas
The core operation is channel-wise linear interpolation at parameter t ∈ [0, 1]:
For n steps, each step index i maps to t = in − 1.
sRGB to linear RGB (gamma decode per IEC 61966-2-1):
Linear RGB to CIE XYZ (D65 illuminant) uses the standard 3×3 matrix:
XYZ to CIELAB with D65 white point (Xn = 0.95047, Yn = 1.0, Zn = 1.08883):
Where f(t) = t13 if t > δ3, else t3δ2 + 429, with δ = 629.
LAB to LCH (polar form):
WCAG 2.1 relative luminance for contrast ratio:
Where v = interpolated channel value, v0 = start channel, v1 = end channel, t = normalized step position, n = total number of steps, Csrgb = sRGB channel normalized to [0, 1], L* = CIELAB lightness, a*/b* = CIELAB chromatic axes, C = chroma, H = hue angle.
Reference Data
| Color Space | Channels | Gamut | Perceptual Uniformity | Hue Linearity | Best Use Case |
|---|---|---|---|---|---|
| sRGB | R, G, B (0 - 255) | sRGB | Poor | Poor (passes through grey) | Simple tint/shade of close colors |
| HSL | H (0 - 360°), S, L (0 - 100%) | sRGB | Poor | Good (follows hue wheel) | Hue rotation, rainbow gradients |
| CIELAB | L* (0 - 100), a*, b* (±128) | Unbounded (clamped) | Good (CIE 1976) | Moderate (straight line in a*b*) | Perceptually even shade ramps |
| CIE LCH | L (0 - 100), C (0 - 150+), H (0 - 360°) | Unbounded (clamped) | Good | Excellent (polar hue arc) | Hue-preserving perceptual gradients |
| Display P3 | R, G, B (0 - 1) | P3 (wider) | Poor | Poor | Wide-gamut screens (not supported here) |
| Oklab | L, a, b | Unbounded | Excellent | Good | Modern CSS Color Level 4 (future) |
| XYZ (D65) | X, Y, Z | Unbounded | Moderate | N/A (device-independent) | Intermediate conversion space |
| HSB/HSV | H, S, B | sRGB | Poor | Good | Color picker models |
| CMYK | C, M, Y, K | Print subtractive | Poor | N/A | Print production |
| CIE LUV | L*, u*, v* | Unbounded | Good | Moderate | Additive color mixing |
| HWB | H, W, B | sRGB | Poor | Good | CSS Color Level 4 |
| Rec. 2020 | R, G, B | Ultra-wide | Poor | Poor | HDR video production |