RGB space
sRGB
The web's default: what a hex code, rgb() and every image without a profile mean.
- White
- D65
- Gamut
- sRGB
- Transfer
- sRGB curve, close to gamma 2.2
The site's gold, written in it
- HEX
#D3AF37 - sRGB (0 to 1)
color(srgb 0.8275 0.6863 0.2157)
Reference · Color spaces
What each space is for, how much color it holds, and how they connect, on one page. Each one links to the Learn article that explains it and the converter that turns it into another.
At a glance
The white point and transfer function are those of CSS Color 4's predefined spaces.
| Space | Kind | White | Gamut | Transfer | Even to the eye | In CSS |
|---|---|---|---|---|---|---|
| sRGB | RGB space | D65 | sRGB | sRGB curve, close to gamma 2.2 | No | #rrggbb · rgb() · color(srgb r g b) |
| Linear sRGB | RGB space | D65 | sRGB | None (linear) | No | color(srgb-linear r g b) |
| HSL and HWB | sRGB, rearranged | D65 | sRGB | sRGB curve | No | hsl() · hwb() |
| Display P3 | Wide RGB space | D65 | Display P3 | sRGB curve | No | color(display-p3 r g b) |
| Rec. 2020 | Wide RGB space | D65 | Rec. 2020 | BT.2020 curve | No | color(rec2020 r g b) |
| Adobe RGB and ProPhoto RGB | Working RGB spaces | D65 · D50 | Adobe RGB · ProPhoto | Gamma 563/256 · gamma 1.8 | No | color(a98-rgb r g b) · color(prophoto-rgb r g b) |
| CIE XYZ | Reference space | D65 · D50 | Every color | None (linear) | No | color(xyz-d65 x y z) · color(xyz-d50 x y z) |
| CIELAB and LCH | Perceptual space | D50 | Every color | Cube root, built in | Roughly; hue drifts in the blues | lab() · lch() |
| Oklab and OKLCH | Perceptual space | D65 | Every color | Cube root, built in | Closer, by design | oklab() · oklch() |
Gamuts
The same three primaries, at the edge of each space, and the area each gamut covers.
Your screen shows about sRGB, so the three swatches in each row look nearly the same. On a Display P3 screen the middle ones are more vivid. Your screen covers Display P3: the middle swatches are more vivid than the sRGB ones, and the Rec. 2020 ones are shown as near as it can. Your screen covers Rec. 2020: each column is more vivid than the one before.
| Primary | sRGB | Display P3 | Rec. 2020 |
|---|---|---|---|
| Red | color(srgb 1 0 0)Chroma 0.258 |
color(display-p3 1 0 0)Chroma 0.299 |
color(rec2020 1 0 0)Chroma 0.365 |
| Green | color(srgb 0 1 0)Chroma 0.295 |
color(display-p3 0 1 0)Chroma 0.369 |
color(rec2020 0 1 0)Chroma 0.468 |
| Blue | color(srgb 0 0 1)Chroma 0.313 |
color(display-p3 0 0 1)Chroma 0.323 |
color(rec2020 0 0 1)Chroma 0.383 |
Chroma is OKLCH's: how far a color is from gray. Each swatch is painted with the value under it; a browser without wide-color support paints its sRGB fallback instead.
| Gamut | Area in xy, against sRGB | Area in u′v′, against sRGB | Share of visible colors, in u′v′ |
|---|---|---|---|
| sRGB | 1.00× | 1.00× | 33.3% |
| Display P3 | 1.36× | 1.26× | 41.8% |
| Adobe RGB (1998) | 1.35× | 1.17× | 38.8% |
| Rec. 2020 | 1.89× | 1.72× | 57.4% |
These are areas on a flat diagram, with lightness left out. The 1976 u′v′ diagram spaces colors more evenly than 1931 xy, so its figures are the fairer comparison. How much a gamut adds in three dimensions is a different number: Gamut Volume: How Much Color a Wide Gamut Actually Adds
The spaces
The values are the site's gold, #D3AF37, in each space; copy any of them.
RGB space
The web's default: what a hex code, rgb() and every image without a profile mean.
The site's gold, written in it
#D3AF37color(srgb 0.8275 0.6863 0.2157)RGB space
sRGB without its curve: the numbers are proportional to light, as blending and lighting maths need.
The site's gold, written in it
color(srgb-linear 0.65141 0.42869 0.0382)sRGB, rearranged
sRGB written as hue with saturation and lightness, or with whiteness and blackness: easy to type, not even to the eye.
The site's gold, written in it
hsl(46.2 63.9% 52.2%)hwb(46.2 21.6% 17.3%)Wide RGB space
A wider RGB space with sRGB's curve and white: the gamut of many current phone and laptop screens.
The site's gold, written in it
color(display-p3 0.80472 0.69157 0.30739)Wide RGB space
The RGB space of ultra-high-definition television, wider again: few screens can show all of it.
The site's gold, written in it
color(rec2020 0.74174 0.66017 0.25864)Working RGB spaces
Photography and print working spaces; ProPhoto is wide enough to hold colors no screen shows.
The site's gold, written in it
color(a98-rgb 0.78545 0.68035 0.26584)color(prophoto-rgb 0.67408 0.63343 0.26964)Reference space
The reference every other space is defined against, from the CIE standard observer: every conversion here passes through it.
The site's gold, written in it
color(xyz-d65 0.42882 0.44786 0.1)color(xyz-d50 0.45463 0.45457 0.07797)Perceptual space
Lightness and two opponent axes, or their polar form: roughly even to the eye, and the basis of the ΔE color difference.
The site's gold, written in it
lab(73.19 4.7 62.68)lch(73.19 62.86 85.71)Perceptual space
A newer perceptual space, designed to keep hue and lightness more even than CIELAB: the one to pick and adjust colors in.
The site's gold, written in it
oklab(76.55% -0.00375 0.13842)oklch(76.55% 0.13847 91.55)Conversions
Every route runs through linear light and, for most, CIE XYZ. These are the steps the site's converters take.
| From and to | Route | Try it |
|---|---|---|
| HEX OKLCH | Hex digits8-bit channelssRGB channels, 0 to 1Linear lightOKLabOKLCH | HEX and OKLCH |
| HEX Display P3 | Hex digits8-bit channelssRGB channels, 0 to 1Linear lightCIE XYZ, D65Linear Display P3Display P3 | HEX and Display P3 |
| Display P3 OKLCH | Display P3Linear Display P3CIE XYZ, D65Linear lightOKLabOKLCH | Open it in the converter |
| HEX Lab | Hex digits8-bit channelssRGB channels, 0 to 1Linear lightCIE XYZ, D65CIE XYZ, D50CIELAB | HEX and Lab |
| Lab LCH | CIELABLCH | Lab and LCH |
| OKLab OKLCH | OKLabOKLCH | OKLab and OKLCH |
| Rec. 2020 Display P3 | Rec. 2020Linear Rec. 2020CIE XYZ, D65Linear Display P3Display P3 | Open it in the converter |
Choosing
| Job | Space | Why | More |
|---|---|---|---|
| Storing and sharing a color | sRGB hex | Every tool, file and browser reads it. | HEX and RGB |
| Picking and adjusting interface colors | OKLCH | Lightness and chroma change the way they look, so scales and themes stay even. | HEX and OKLCH |
| Showing more vivid color where the screen can | Display P3, with an sRGB fallback | Screens that cover P3 show it; others show the fallback. | Wide color in CSS |
| Measuring how different two colors look | CIELAB, with ΔE 2000 | The standard color-difference formula is defined on it. | ΔE Metrics from CIE76 to CIEDE2000 and ΔEITP |
| Mixing colors and drawing gradients | Oklab, or linear sRGB for light | Blends stay bright through the middle instead of passing through gray. | Color Gradients and Interpolation |
| Defining one space in terms of another | CIE XYZ | Every space here is defined against it. | CIE XYZ Explained |
| CMYK, through an ICC profile | Ink depends on the press and the paper, so no single formula is right. | CMYK and the Four-Color Printing Process |
In CSS
Two ways to use a color outside sRGB. A browser skips a declaration it cannot read, so the line before it stays.
One declaration, in OKLCH
/* A green that Display P3 screens can show and sRGB screens cannot. */
.accent {
color: #00ba64; /* older browsers: the nearest sRGB color */
color: oklch(69.28% 0.23895 153.13); /* the full color, fitted to the screen by the browser */
}
Only on screens that cover P3
.accent { color: #00ba64; }
@media (color-gamut: p3) {
.accent { color: color(display-p3 0.1 0.75 0.35); }
}
The fallback, then the full color: on a P3 screen the second is more vivid. Color in CSS: Modern Color in the Browser
Read more
Each space is explained in full in the Learn library; these are the articles, by topic.
Sources
Every value here is computed by the site's color code, which is tested against the CSS Color 4 examples.