CSS Color 4 in Print

CSS Color 4 in Print

Mike Bremford • mike@bfo.com • Feb 2021

Color swatches

Print and CSS Color 4?

Why should we listen to you?

Let's compare: CSS Color 3

CSS PDF
sRGB DeviceRGB
HSL -
ICCBased (also CalRGB, CalGray)

Let's compare: CSS Color 4

CSS PDF
sRGB DeviceRGB
HSL -
HWB -
ICC (also display-p3, rec2020, xyz etc) ICCBased (also CalRGB, CalGray)
device-cmyk DeviceCMYK
Lab Lab
LCH -
- DeviceN (also Separation)

Alternative coordinates: HWB, HSL and LCH

LCH and Lab are different views of the same colorspace. Lab uses cartesian coordinates, LCH uses polar. HWB/HSL are roughly the same, but for sRGB. SVG showing the cartesian coordinates x=40, y=30 0 10 20 30 40 50 40 30 20 10 0 a=40 b=30 SVG showing the polar coordinates h=50, θ=36° 0 10 20 30 40 50 40 30 20 10 0 hue=36° radius=50
lab(75% 40 30)
=
lch(75% 50 36deg)

Gradients

Simply converting the endpoints from LCH to Lab is not enough. We also need to control how we interpolate.

Colored grid showing the Lab colorspace, and comparing the linear path between two coordinates and the curved path traced between the same points in the Lch colorspace Lab Lch Lab L=75% a = -128 a = 128 b = 128 b = -128
lch(75% 70 -135deg) lch(75% 70 45deg)
lab(75% -50 -50) lab(75% 50 50)
Note: macOS preview may not display these gradients properly

Interpolation

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.

Let's recompare: CSS Color 4

CSS PDF
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)

So it's all working perfectly?

Print is mostly CMYK, ICC and Spot color

A CMYK magazine cover

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.

Thank You

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)

BFO Logo