HCL color space
# HCL color space

HCL (Hue-Chroma-Luminance) or LCh refers to any of the many cylindrical color space models that are designed to accord with human perception of color with the three parameters. Lch has been adopted by information visualization practitioners to present data without the bias implicit in using varying saturation. They are, in general, designed to have characteristics of both cylindrical translations of the RGB color space, such as HSL and HSV, and the L*a*b* color space. Some conflicting definitions of the terms are:

* A name for a cylindrical transformation of CIELuv $(CIELCh_{uv})$ employed by Ihaka (2003) and adopted by Zeileis et al. (2009, 2020). This name appears to be the one most commonly used in information visualization. Ihaka, Zeileis, and co-authors also provide software implementations and web pages to promote its use.
* A name for cylindrical CIELab $(CIELCh_{ab}),$ employed by chroma.js.
* "HCL" designed in 2005 by Sarifuddin and Missaou, which is a transformation of whatever type of RGB color space is in use.

## Derivation

### Color-making attributes

HCL concerns the following attributes of color appearance:

**Hue**


    The "attribute of a visual sensation according to which an area appears to be similar to one of the perceived colors: red, yellow, green, and blue, or to a combination of two of them".

**Lightness, value**


    The "brightness relative to the brightness of a similarly illuminated white".

**Luminance (Y or $L_{v,Ω})**$


    The radiance weighted by the effect of each wavelength on a typical human observer, measured in SI units in candela per square meter $(cd/m^2).$ Often the term luminance is used for the relative luminance, $Y/Y_n,$ where $Y_n$ is the luminance of the reference white point.

**Colorfulness**


    The "attribute of a visual sensation according to which the perceived color of an area appears to be more or less chromatic".

The HSL and HSV color spaces are more intuitive translations of the RGB color space, because they provide a single hue number. However, their luminance variation does not match the way humans perceive color. Perceptually uniform color spaces outperform RGB in cases such as high noise environments.

### CIE color spaces

CIE-based LCh color spaces are transformations of the two chroma values (ab or uv) into the polar coordinate. The source color spaces are still very well-regarded for their uniformity, and the transformation does not cause degradation in this aspect. See the respective articles for how the underlying coordinates are derived.

### Sarifuddin 2005

Sarifuddin, noting the lack of blue hue consistency of CIELAB—a common complaint among its users— decided to make their own color space by mashing up some of the features.

According to the Stack Overflow user Tatarize, what Sarifuddin proposes as "HCL" is algorithmically similar to HSL. While pointing out advantages in computational efficiency, they argue that Sarifuddin's work does not represent a significant improvement over the CIELAB color space while showing failure to reproduce the paper's claims. They also propose what they consider to be an improved version of Sarifuddin's algorithm.

### Other color appearance models

In general, any color appearance model with a lightness and two chroma components can also be transformed into a HCL-type color space by turning the chroma components into polar coordinates.

## Implementations

CIELCh has been implemented in a wide range of ways: as programmatic code for generating color swatches in statistics tools, as standalone tools for designing and testing swatches, or as libraries that allow other programs to use the color space. Some implementations include:

* Statistical tools:
   * d3.js: Data Driven Documents JavaScript library $(CIELCh_{ab})$
* Swatch designs:
   * The colorspace package for the R and the Python programming languages, also with pre-made sets of swatches in hclwizard
   * Fabio Crameri's scientific colour maps, a set of pre-made swatches
* Library:
   * The aforementioned colorspace library $(CIELCh_{uv})$
   * ac-colors JavaScript library $(CIELCh_{ab}$ and $CIELCh_{uv})$
   * chroma.js JavaScript library $(CIELCh_{ab})$
   * colorio for Python
   * Most other color space libraries handle at least one of CIELUV or CIELAB
