Good to know
What you can paste
Anything your browser accepts as a CSS colour: hex codes with 3, 4, 6 or 8 digits, the CSS colour names, rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch() and color(). A 3 or 6 digit hex code also works without the #. Your browser reads the value itself, so the rules are exactly those of CSS. Colours outside the sRGB range, such as a very vivid display-p3 green, are brought to the nearest sRGB colour first.
A worked example
Dodger blue, #1e90ff, is red 30, green 144, blue 255. The table shows:
| RGB | rgb(30 144 255) |
|---|---|
| HSL | hsl(209.6 100% 55.9%) |
| HWB | hwb(209.6 11.8% 0%) |
| OKLCH | oklch(65.2% 0.1901 253.21) |
| CMYK (approx.) | 88% 44% 0% 0% |
How each format is worked out
HSL comes from the largest and smallest of the three channels: lightness is their average, saturation is how far apart they are, and the hue says which channel leads. HWB uses the same hue, with whiteness equal to the smallest channel and blackness equal to 1 minus the largest.
OKLCH follows the conversion in the W3C CSS Color Module Level 4: the channels are linearised, turned into CIE XYZ (D65), then into OKLab with its published matrices and a cube root, and finally into lightness L, chroma C and hue H. Equal steps of OKLCH lightness look like equal steps to the eye, which HSL does not manage.
CMYK uses the simple textbook formula, with r, g and b from 0 to 1:
K = 1 − max(r, g, b) C = (1 − r − K) ÷ (1 − K) M = (1 − g − K) ÷ (1 − K) Y = (1 − b − K) ÷ (1 − K)
Real printing depends on the press, the paper and the inks, which a colour profile such as FOGRA or GRACoL describes. This formula knows none of that, so treat the CMYK row as a starting point and ask your printer for the final values.
Transparency
If your colour has an alpha value, it carries through: HEX gains two digits and the other formats end in / 0.5 or similar. The white or black text note ignores transparency.