Color scheme

Wide Gamut and Display P3

You just spent a week working with oklch(), building palette ramps, and defining semantic tokens. You may have noticed that oklch() lets you type in extremely vivid chroma values, but the color you see on screen sometimes looks duller than expected. That is not a bug in your code. It is a gap between what the color space can describe and what your display can show. Understanding that gap is what this page is about.

This topic is not something you need to adopt in every project. Most UI work lives comfortably inside sRGB, and that is fine. But knowing what a display gamut is, how it differs from a color space, and how to reach for wider colors when the design calls for it will help you make informed decisions rather than confused ones.

Color Space vs. Display Gamut

These two terms get confused constantly, so let us be precise about what each one means.

A color space is a mathematical model for describing colors. oklch(), srgb, hsl(), and lab() are all color spaces. They define how you write down a color: which channels exist, what their ranges are, and how the math relates to human perception. A color space can describe colors that no screen on earth can display. It is a language, not a physical limitation.

A display gamut is the range of colors a physical screen can actually reproduce. sRGB, Display P3, and Rec. 2020 are display gamuts. They define the boundaries of what the hardware can show. A gamut is a subset of all possible colors, and every gamut is smaller than human vision.

Here is the key distinction: oklch() is a color space. It can describe colors inside sRGB, inside P3, and even beyond P3. But describing a color does not mean the screen can show it. If you write oklch(0.7 0.35 150) (an extremely vivid green), that color exists in the oklch color space, but it falls outside the sRGB gamut. On an sRGB display, the browser will clamp it to the nearest color the screen can reproduce. On a P3 display, it might be able to show the full value, or it might still need to clamp because even P3 does not cover the entire oklch range.

The Practical Takeaway

Using oklch() does not automatically give you P3 colors. And using color(display-p3 ...) does not change the color space you are working in. The color space is how you describe the color. The display gamut is whether the screen can show it. They are independent.

What Is Display P3?

Display P3 is a color gamut developed by Apple based on the DCI-P3 cinema standard. It covers roughly 25% more of the visible color spectrum than sRGB. The expansion is not evenly distributed: P3 adds the most range in vivid greens and saturated reds, while blues gain very little. This is why P3 screens make the biggest visible difference on nature photography, food imagery, and brand colors with high saturation.

Most modern Apple devices (iPhones, iPads, MacBooks since 2016) have P3-capable screens. Many newer Windows laptops, Android phones, and professional monitors also support P3, though it varies more by model. The important point is that P3 support is widespread enough that it is worth knowing about, but not universal enough to rely on without fallbacks.

In CSS, you access P3 colors using the color() function with the display-p3 color space identifier. The channels are red, green, and blue, each normalized to a 0 to 1 range:


        /* A vivid green that sRGB cannot fully reproduce */
        .highlight {
            background: color(display-p3 0.2 0.85 0.3);
        }
    

On a P3-capable screen, this green will be noticeably more vivid than the closest sRGB equivalent. On an sRGB screen, the browser clamps it to the nearest reproducible color. The page does not break. It just looks slightly less vivid.

When Would You Actually Use This?

The honest answer is: rarely, and only for specific visual impact. Most UI work does not need P3 colors. Body text, borders, subtle backgrounds, muted neutrals, and most of your token system live comfortably inside sRGB. The difference between sRGB and P3 is only visible on highly saturated colors, and most well-designed interfaces lean toward restrained palettes.

The cases where P3 makes a genuine difference are narrow but real:

  • A brand accent color that needs to be as vivid as possible on screens that can handle it. Think a neon green logo, a saturated red call-to-action, or a deep electric blue hero gradient.
  • Data visualization where you need more perceptually distinct colors to differentiate categories in a chart or graph.
  • Product photography or color swatches where the displayed color needs to match a physical product as closely as the screen allows.
  • A vivid gradient or shadow that serves as a focal point in the design, where the extra saturation makes a visible difference.

If you are building a standard content site, a dashboard, or a form-heavy application, you probably do not need P3 colors anywhere. And that is perfectly fine. Using oklch() for your palette ramps (as you did this week) already gives you perceptual uniformity and a wide range of well-behaved colors inside sRGB. P3 is an enhancement, not a requirement.

Writing Safe Fallbacks

If you do reach for P3 colors, you need a fallback for sRGB screens and older browsers. There are two clean patterns.

The Duplicate Declaration Pattern

The simplest approach is to declare the sRGB version first, then the P3 version second. Browsers that understand color(display-p3 ...) use the second declaration. Browsers that do not understand it ignore it and keep the first:


        .brand-accent {
            /* sRGB fallback */
            background: rgb(0, 200, 80);

            /* P3 enhancement (ignored by browsers that don't support it) */
            background: color(display-p3 0.2 0.85 0.3);
        }
    

This works because CSS discards declarations with values it does not recognize. The cascade keeps the last valid value. On an sRGB-only browser, only the first line is valid. On a P3-capable browser, both are valid and the second wins.

The @supports Guard

When you need to override a custom property (where the duplicate declaration pattern does not work cleanly), use @supports:


        :root {
            --brand-green: rgb(0, 200, 80);
        }

        @supports (color: color(display-p3 0 0 0)) {
            :root {
                --brand-green: color(display-p3 0.2 0.85 0.3);
            }
        }
    

This is the safer pattern for custom properties because some browsers parse the color() function as syntactically valid (and therefore "win" the cascade) even when the display cannot actually render P3. The @supports block ensures the override only applies when the browser genuinely understands the function.

The color-gamut Media Query

If you want to target the display hardware rather than just the browser's CSS parser, the color-gamut media query checks whether the user's screen supports a given gamut:


        :root {
            --brand-green: rgb(0, 200, 80);
        }

        @media (color-gamut: p3) {
            :root {
                --brand-green: color(display-p3 0.2 0.85 0.3);
            }
        }
    

The difference is subtle: @supports tests whether the browser understands the syntax, while @media (color-gamut: p3) tests whether the display can show the colors. In practice, most P3-capable devices have browsers that support the syntax, so either approach works. The @media query is slightly more precise because it accounts for the hardware.

How This Connects to oklch()

You might wonder whether you need color(display-p3 ...) at all if you are already using oklch(). The answer depends on what you are trying to do.

oklch() can describe colors that fall outside sRGB. If you set a chroma value high enough, the resulting color will be in P3 territory or beyond. On a P3 screen, the browser will render it at full vividness. On an sRGB screen, the browser clamps it to the nearest sRGB color using the CSS gamut mapping algorithm. This means oklch() already gives you P3 colors implicitly when the hardware supports it, without needing a separate color(display-p3 ...) declaration.

So when would you use color(display-p3 ...) directly? Two situations: when you have a specific P3 color value from a design tool (Figma exports P3 values in this format), or when you want explicit control over the fallback rather than relying on the browser's automatic gamut mapping. The automatic clamping is usually fine, but designers who care deeply about the exact sRGB fallback may prefer to hand-pick it.

Contrast Still Matters

A more vivid color does not excuse unreadable text. If you use a P3 accent color for a button background, you still need to verify that the text contrast meets WCAG requirements in both the P3 version and the sRGB fallback. Vivid backgrounds can actually make contrast problems worse because the extra saturation can reduce perceived lightness difference.

Resources

Teaching Video Checklist

When you record your teaching video, make sure your teammates come away understanding these concepts:

  • The difference between a color space (like oklch()) and a display gamut (like sRGB or P3), and why they are independent concepts
  • What Display P3 is, which devices support it, and where the extra color range actually shows up (greens and reds, not blues)
  • The color(display-p3 r g b) syntax and how the channels differ from rgb() (normalized 0 to 1 instead of 0 to 255)
  • At least one fallback pattern: the duplicate declaration approach or the @supports / @media (color-gamut: p3) guard
  • How oklch() already reaches into P3 territory at high chroma values, and when you would use color(display-p3 ...) directly instead

For your demo, create at least two color swatches side by side: one declared in sRGB and one declared in P3. Show them in Chrome DevTools using the gamut emulation tools to demonstrate what happens on sRGB vs. P3 screens. If your screen supports P3, point out which swatch looks more vivid and explain why.