Explore OKLab gamut mapping in oklch

This is a modification of svgees.us/Color/ok-clip-lch-explorer.html

The top row is some of the original code.

For the lower two rows: The left column shows gamut mapping to sRGB. The middle column shows gamut mapping to P3. The right column shows gamut mapping to Rec2020.

The middle row is clipped to sRGB after the gamut mapping. The middle row is clipped to P3 after the gamut mapping.

Compared to (on the right) current color.js gamut mapping algorithm, which operates in CIE LCH with deltaE 2000.

Lightness: 0.50

OKLCH, ΔEOK Clip Gamut: ≤sRGB:Red, ≤P3:Green, ≤Rec2020:Blue
Gamut mapped to sRGB Gamut mapped to P3, clipped to sRGB Gamut mapped to Rec2020, clipped to sRGB
Gamut mapped to sRGB, clipped to P3 (no-op) Gamut mapped to P3 Gamut mapped to Rec2020, clipped to P3

Typical gamut mapping times (mean over for 2,500 mappings ie a 50 x 50 grid):