CKTIS / CSS
lch(): polar coordinates for CIE Lab
Use lightness, chroma and hue instead of the rectangular Lab axes.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
color: lch(50% 40 30deg);lch() describes the same CIE Lab color space using polar coordinates. L is lightness, C is chroma and H is hue. Chroma measures distance from the neutral axis; hue gives the direction around that axis. This is not HSL saturation: equal numerical values in lch() and hsl() do not describe the same color or the same adjustment.
Hue can be written as an angle or a number interpreted in degrees, and full turns wrap to the same direction. At zero chroma, changing hue does not change the neutral result because there is no chromatic direction to display. Optional slash alpha controls compositing. High chroma can move a color beyond the target gamut; converting it to screen RGB may require gamut handling.
The example compares zero-chroma colors with different hue angles and obtains the same gray. It then paints lch(50% 40 30deg) and the equivalent hue after a full turn, obtaining matching pixels. The test deliberately compares related colors rather than assuming that an arbitrary LCH color is guaranteed to fit every display.
Examples
const sample=async style=>{const svg='<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><rect width="8" height="8" fill="white"/><foreignObject width="8" height="8"><div xmlns="http://www.w3.org/1999/xhtml" style="width:8px;height:8px;'+style.replaceAll('&','&').replaceAll('"','"')+'"></div></foreignObject></svg>';const image=new Image();image.src='data:image/svg+xml;charset=utf-8,'+encodeURIComponent(svg);await image.decode();const canvas=document.createElement('canvas');canvas.width=canvas.height=8;const context=canvas.getContext('2d');context.drawImage(image,0,0);return [...context.getImageData(4,4,1,1).data].slice(0,3).join(',')};
const gray0=await sample('background:lch(50% 0 0deg)');
const gray240=await sample('background:lch(50% 0 240deg)');
const hue=await sample('background:lch(50% 40 30deg)');
const wrapped=await sample('background:lch(50% 40 390deg)');
console.log('zero-chroma='+gray0+'/'+gray240+'; hue='+hue+'; wrapped='+wrapped);Result
zero-chroma=119,119,119/119,119,119; hue=178,93,87; wrapped=178,93,87
The matching zero-chroma samples and wrapped-hue samples demonstrate two distinct invariances of the polar representation.