CSS: color() function

By Xah Lee. Date: . Last updated: .
xtodo

What is color() function

color() function let you specify colors in Wider Gamut Color, in many standard color spaces, and also let you specify relative color.

Syntax

color(display-p3 r g b / a)
Most practical wide-gamut option (Apple's Display P3, ~50% more colors than sRGB).
color(rec2020 r g b)
Even wider, used in broadcasting.
color(a98-rgb ...)
Adobe RGB.
color(prophoto-rgb ...)
For photography.
Others
srgb, srgb-linear, xyz-d50, xyz-d65, etc.

Example

.x {
 background: color(display-p3 0 1 0);
 /* A very vivid green */
}

CSS Color