Mike Bremford • mike@bfo.com • Feb 2021
CSS | |
---|---|
sRGB | DeviceRGB |
HSL | - |
ICCBased (also CalRGB, CalGray) |
CSS | |
---|---|
sRGB | DeviceRGB |
HSL | - |
HWB | - |
ICC (also display-p3, rec2020, xyz etc) | ICCBased (also CalRGB, CalGray) |
device-cmyk | DeviceCMYK |
Lab | Lab |
LCH | - |
- | DeviceN (also Separation) |
Simply converting the endpoints from LCH to Lab is not enough. We also need to control how we interpolate.
In CSS, all interpolation is linear. But PDF has more choices: we can stitch functions, use sampled functions, even PostScript. So simulating an LCH gradient in Lab is easy; we just need the right function.
Many ways to do this: we make a linear function, sample it halfway and measure ΔE(CIE94). If it's too far, we split the function and repeat for each half - De Casteljau's algorithm. Good for simulating HSL/HWB in RGB too.
CSS | |
---|---|
sRGB | DeviceRGB |
HSL | DeviceRGB |
HWB | DeviceRGB |
ICC (also display-p3, rec2020, xyz etc) | ICCBased (also CalRGB, CalGray) |
device-cmyk | DeviceCMYK |
Lab | Lab |
LCH | Lab |
- | DeviceN (also Separation) |
identityXYZ ICC profile for
color(xyz n n n)
. Same for 7-color
FOGRA55.
Coons Patchgradients are required for CSS
conic-gradient
.
But these typically interpolate in the wrong color space - sRGB or similar.
The corner colors are correct; the solutionis to use smaller patches so the interpolation matters less. Coons Patches will also be required if the proposed
<meshgradient>
is added to SVG.
CMYK is widely supported. All commercial engines use cmyk(0%, 22%, 5%, 0%)
ICC may be supported, in implementation-specific ways.
@color-profile
will help.
Device-independent color is required for PDF/A and PDF/UA, widely required by governments. Demand for these should help adoption.
mike@bfo.com
https://bfo.com/misc/css-color4-presentation
https://bfo.com/misc/css-color4-presentation.pdf
(The PDF version of this presentation demonstrates all of the concepts discussed)