The sRGB to Display P3 converter translates standard web colors into the wide-gamut Display P3 space used by modern Apple and other high-end screens. It produces a CSS color(display-p3 r g b) value that renders identically on calibrated P3 displays while sRGB screens fall back gracefully.
How it works
sRGB and Display P3 share the same transfer curve but use different primaries, so converting between them is a matrix transform in linear light:
- Linearize each sRGB channel by inverting the sRGB gamma curve (the piecewise function with the 0.04045 threshold).
- sRGB → XYZ: multiply the linear sRGB vector by the standard sRGB-to-XYZ matrix.
- XYZ → linear P3: multiply by the XYZ-to-linear-Display-P3 matrix.
- Re-encode each linear P3 channel with the P3 transfer curve (same gamma as sRGB) to get the final 0–1 components.
The result is the precise Display P3 representation of your input color.
Notes
- Components are emitted in the
0–1range thatcolor(display-p3 ...)expects, not0–255. - Because every sRGB color fits inside the P3 gamut, the conversion never clips for valid sRGB input.
- The benefit of P3 is the extra saturated colors it can reach; converting an existing sRGB color simply re-expresses the same appearance.
All calculations run locally in your browser — nothing is uploaded.