Color Spaces
The defined systems that map numbers to visible colors. From sRGB and Display-P3 to CIE XYZ and OKLab, every digital color passes through one of these.
Model vs space
A color model is a mathematical framework — RGB, CMYK, Lab. A color space is a specific instance of a model with concrete parameters: primaries, white point, gamma curve. The distinction matters because two implementations of the "same" model can describe different colors.
| Model | Example spaces |
|---|---|
| RGB (additive) | sRGB, Display-P3, Adobe RGB, Rec.2020, ProPhoto RGB |
| CMY (subtractive) | SWOP CMYK, FOGRA39, GRACoL |
| XYZ (device-independent) | CIE XYZ, D50, D65 |
| Lab / LCH | CIE Lab (D50 or D65), CIE LCH |
| OKLab / OKLCH | OKLab, OKLCH |
The major RGB spaces
RGB is one model, but several color spaces use it with different primaries and gamma. The result is that the same RGB numbers describe different colors depending on which space they are in.
| Space | White point | Gamut size | Typical use |
|---|---|---|---|
| sRGB | D65 | Baseline | Web, consumer displays, default CSS |
| Display-P3 | D65 | ~25% wider than sRGB | Modern phones, laptops, cinema displays |
| Adobe RGB | D65 | Wider greens and cyans | Photography, print preparation |
| ProPhoto RGB | D50 | Very wide | High-end photo editing, raw processing |
| Rec.2020 | D65 | Much wider than P3 | UHD TV, HDR video |
Device-independent spaces
Some spaces do not depend on any device. They describe absolute color, defined by the CIE's standard observer model.
CIE XYZ
The master device-independent space. All other color spaces are defined relative to XYZ. XYZ describes color as three tristimulus values (X, Y, Z) that are linear combinations of the eye's three cone responses. Y is proportional to luminance. XYZ is not perceptually uniform but is the reference for everything else.
CIE Lab
A perceptual transformation of XYZ. L* is lightness, a* is the green-red axis, b* is the blue-yellow axis. Lab is designed so equal numeric differences correspond to roughly equal perceptual differences. Standard in color science and print.
CIE LCH
The polar form of Lab. L is lightness, C is chroma (saturation), h is hue angle. More intuitive than Lab for hue-based work.
OKLab / OKLCH
A modern (2020) perceptual space designed by Björn Ottosson. It is simpler to compute than CIE Lab and handles the blue region more evenly. Increasingly the standard for design systems and CSS.
How spaces convert to each other
Conversion between color spaces happens through a small number of hubs. In practice, most conversions pass through either linear RGB or XYZ:
sRGB ──▶ linear sRGB ──▶ XYZ ──▶ Lab ──▶ LCH
│
└──▶ OKLab ──▶ OKLCH
Display-P3 ──▶ linear P3 ──▶ XYZ (same hub)
Adobe RGB ──▶ linear Adobe RGB ──▶ XYZ (same hub)
XYZ is the universal hub for device-independent conversion.
This is why a well-designed color library never converts directly from one RGB space to another. It always goes through the shared hub, applying the correct transformation for each side.
Practical consequences
-
Same numbers, different colors.
rgb(255, 0, 0)in sRGB and in Display-P3 are different colors. CSS treats unspecified RGB as sRGB. - Gamut matters. Colors outside a space's gamut cannot be displayed in it — they must be clipped or mapped to the nearest reproducible color.
- Color accuracy requires profiles. Real print and screen workflows embed ICC profiles to describe exactly which space a color value is in.
- Perception is not the same as gamut. Lab, OKLab and OKLCH are perceptual — they describe how colors look. sRGB, P3 and Adobe RGB are device spaces — they describe what a screen or printer can output.
Which space should I use?
| Task | Recommended space |
|---|---|
| Web CSS colors | sRGB (default); Display-P3 for wide-gamut accents |
| Design tokens | OKLCH for computation, sRGB or hex for delivery |
| Palette generation | OKLCH or OKLab |
| Gradient interpolation | OKLab or OKLCH |
| Print production | Lab / LCH for reference, CMYK profile for output |
| Photography editing | ProPhoto RGB or Adobe RGB, then convert |
| Video / HDR | Rec.2020 |
Continue reading
Frequently asked questions
What is a color space?
A color space is a defined system for describing colors numerically. It defines which colors can be represented, and how numerical values map to visible light. Examples include sRGB, Display-P3, Adobe RGB, CIE Lab and OKLab.
What is the most common color space?
sRGB is the most widely used color space. It is the default for the web, most consumer displays, and the standard CSS color model. Virtually every screen, browser and OS uses sRGB as its baseline, even when they support wider gamuts.
What is the difference between a color space and a color model?
A color model is a mathematical framework — RGB, CMYK, Lab. A color space is a specific instance of a model with defined primaries, white point and gamma. sRGB is a color space; RGB is the model.
Which color space should I use for the web?
Use sRGB for maximum compatibility. Use Display-P3 only when you need brighter, more saturated colors and can accept fallback to sRGB for older devices. For perceptual palettes, use OKLCH to compute values and then output them in sRGB or P3 as CSS values.
Is P3 replacing sRGB?
Not exactly. P3 is becoming more common on modern displays, but sRGB is still the universal baseline. Most design systems ship sRGB primitives and optionally add P3 overrides for wide-gamut devices. The safest strategy is sRGB-first, P3 as an enhancement.