Helmlab
Helmlab is an open-source color space family trained on over 64,000 individual human color perception observations. It is available as Python and JavaScript/TypeScript libraries.[1] It is distributed under the MIT License.[2] The measurement space (MetricSpace) achieves a STRESS value 20.1% lower than the CIEDE2000 standard on the COMBVD dataset; the generation space (GenSpace) offers 6× better hue accuracy than Oklab.[1]
Architecture
Helmlab consists of two color spaces optimized for different purposes:
MetricSpace
MetricSpace (72 parameters) uses a 13-stage transform pipeline optimized for perceptual color difference measurement:
XYZ → M₁ → γ → M₂ → Hue correction → H-K → L → C → HL → NC → φ → Lab
This pipeline converts CIE XYZ tristimulus values to perceptual Lab coordinates. It includes hue correction, Helmholtz–Kohlrausch effect modeling (chroma-dependent lightness, learned from data), chroma scaling, neutral correction, and rigid rotation (φ = −28.2°). The neutral correction stage reduces the chromaticity of grays to C < 10⁻⁶, providing an achromatic guarantee. Rigid rotation reduces hue error at zero cost to the distance metric (RMS 16.1°). Every stage of the pipeline is exactly invertible.[1]
GenSpace
GenSpace (21 parameters) uses a minimal linear-algebra pipeline optimized for color generation (gradients, palettes):
XYZ → M₁ → γ = ⅓ → M₂ → NC → Lab
It uses Phase1H-optimized M₁/M₂ matrices with shared cube-root compression (γ = ⅓). It contains no enrichment stages; the pure linear-algebra pipeline is fast and invertible. Hue accuracy is 6× better than Oklab (RMS 5.2° vs 30.1°). The gradient() function employs CIEDE2000 arc-length reparameterization to produce perceptually uniform steps for any color pair.[1]
Dataset and methodology
COMBVD dataset
COMBVD is a combined visual-difference dataset of 3,813 color pairs compiled from six independent psychophysical experiments:[1]
- Luo and Rigg (1986)
- RIT-DuPont
- Witt
- Leeds
- BFD
- He et al. (2022)
It comprises over 64,000 individual human observations. In each experiment, observers viewed color pairs under controlled D65 illumination and rated the perceived differences.[1]
STRESS metric
STRESS (Standardized Residual Sum of Squares) is the CIE-standard metric for evaluating color difference formulas. For each color pair i, ΔVi denotes the human visual difference and ΔEi the predicted distance. STRESS finds the optimal scale factor F that minimizes the residuals:[1]
Scale: 0 = perfect agreement, 100 = no correlation.
Optimization
The 72 parameters of MetricSpace were optimized on the COMBVD training set using L-BFGS-B with eight random restarts. The data was split 80% training / 20% test (seed = 42). The analytical form of the model—every operation is a known mathematical function—serves as a structural regularizer.[1]
Five-fold cross-validation yields a mean STRESS of approximately 23.5, confirming generalization beyond the training set. Bootstrap confidence intervals (10,000 iterations): Helmlab 95% CI [22.50, 23.93], CIEDE2000 95% CI [27.64, 30.84]. The two intervals have zero overlap (p < 10⁻⁴).[1]
Perceptual distance performance
MetricSpace achieves a STRESS value of 23.30 on the COMBVD dataset. This is 20.1% lower than CIEDE2000's STRESS of 29.18.[1]
| Method | STRESS | vs CIEDE2000 |
|---|---|---|
| Helmlab MetricSpace | 23.30 | −20.1% |
| CIEDE2000 | 29.18 | — |
| CIE94 | 33.59 | +15.1% |
| CAM16-UCS | 33.90 | +16.2% |
| ΔE CMC | 34.04 | +16.6% |
| IPT | 41.21 | +41.3% |
| CIE Lab ΔE76 | 42.80 | +46.7% |
| Oklab | 47.46 | +62.7% |
Gradient uniformity
The table below compares CV (coefficient of variation of CIEDE2000 step sizes). A lower value indicates a more uniform gradient.[1]
| Method | Red→Blue | Orange→Cyan | Black→White | Technique |
|---|---|---|---|---|
Helmlab gradient() |
≈ 0% | ≈ 0% | ≈ 0% | arc-length reparam. |
| Helmlab GenSpace | 3.1% | 33.2% | 41.0% | linear interpolation |
| Oklab | 31.5% | 41.4% | 41.2% | linear interpolation |
| CIE Lab | 44.8% | 52.3% | 61.5% | linear interpolation |
Helmlab's gradient() function achieves ≈ 0% CV via CIEDE2000 arc-length reparameterization, an algorithm that redistributes steps to equal perceptual spacing. The Oklab and CIE Lab values reflect naive linear interpolation, which is how most libraries use them. The same reparameterization technique could be applied to any color space; Helmlab ships it built-in.[1]
Features
- Perceptual color difference measurement (
deltaE) - Achromatic guarantee — grays are mapped to C < 10⁻⁶ chromaticity via neutral correction
- Embedded Helmholtz–Kohlrausch effect — lightness is chroma-dependent, learned from data
- Hue improvement via rigid rotation (RMS 16.1°) at zero cost to the distance metric
- WCAG contrast ratio computation and automatic enforcement
- Gradient generation via CIEDE2000 arc-length reparameterization
- Tailwind CSS-style 50–950 semantic palette generation
- sRGB and Display P3 gamut mapping
- Dark/light mode adaptation
- Design token export (CSS, Android XML, iOS Swift, JSON)
Technical details
The JavaScript package is approximately 12 KB (gzip) with zero external dependencies, and provides ESM + CJS dual output with full TypeScript type definitions.[3] It is also available via CDN. The Python package requires NumPy and SciPy.[4]
The project is verified by 337 automated tests (233 Python + 104 JavaScript).[2]
References
- ↑ 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 Yıldız, Görkem (2026). "Helmlab: A Data-Driven Analytical Color Space for UI Design Systems". arXiv:2602.23010 [cs.GR].
- ↑ 2.0 2.1 "Helmlab — GitHub". Retrieved 2026-03-03.
- ↑ "helmlab — npm". Retrieved 2026-03-03.
- ↑ "helmlab — PyPI". Retrieved 2026-03-03.
External links
- Official website
- Documentation
- GitHub repository
- arXiv paper
- npm package
- PyPI package
- Helmlab (Türkçe Vikipedi)
Category:Color space Category:Free science software Category:Python (programming language) libraries Category:JavaScript libraries Category:Software using the MIT license
This article "Helmlab" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Helmlab. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
