1. Presentation
  2. Color

Presentation ยท Layer 2

Color

Color is the least reliable channel on a page. The author proposes a color; the display, the room, and the reader's eyes and settings decide what is seen. These pages teach enough about light, color spaces and CSS color to turn a designer's swatches into named colors that survive all of them.

How these pages use color

Every example in this section follows the same rules, and the pages explain why as they go:

The CSS in these pages follows the CSS section's house style.

The pages

  1. 01Why color matters

    Color as interface: identity, hierarchy, state and mood, and the one channel the author cannot guarantee reaches the reader.

  2. 02How color works

    Light and the eye, models and spaces, gamut, perceptual lightness, and a short history of web color, from sixteen names and the web-safe palette to oklch().

  3. 03Color in CSS

    Every notation, where color applies, currentColor, out-of-gamut colors, and turning a designer's hex into tokens.

  4. 04Deriving color

    color-mix(), relative colors, contrast-color(), gradient interpolation, and a whole set of states from one token.

  5. 05Choosing and pairing

    Harmony, proportion, tonal scales, roles over values, neutrals, status colors and palettes for data.

  6. 06Light and dark

    color-scheme, prefers-color-scheme, light-dark(), a three-state toggle, and designing a dark palette on purpose.

  7. 07Displays and environments

    Wide gamut and HDR as enhancements, images that carry their own color, the room, grayscale and print.

  8. 08Color for people

    Contrast measured, never color alone, color vision, low vision, forced colors, contrast preferences and focus you can see.

  9. 09Color across cultures

    Meaning that is learned, conventions that flip, how language divides color, and signal colors as locale data.

Films

A narrated film goes with these pages.

Asking the platform

Ask the browser what it can do and what the reader wants; never guess from the browser's name. Each question has a CSS answer and, where a script needs to know, a JavaScript one. The page that teaches each is in the last column.

Detecting color support and color preferences, October 2026
QuestionCSSJavaScriptSupport, October 2026Taught in
Can it parse oklch()?@supports (color: oklch(0% 0 0))CSS.supports("color", "oklch(0% 0 0)")Widely available03, Color in CSS
Relative colors?@supports (color: oklch(from red l c h))the same patternNewly available, September 202404, Deriving color
contrast-color()?@supports (color: contrast-color(red))the same patternNewly available, April 202604, Deriving color
Light or dark preference?@media (prefers-color-scheme: dark)matchMedia() with a change listenerWidely available06, Light and dark
Does the server need the scheme first?nonethe Sec-CH-Prefers-Color-Scheme request header, opted in with Accept-CHChromium only06, Light and dark
A wide-gamut or HDR screen?@media (color-gamut: p3), (dynamic-range: high)matchMedia()Widely available; Firefox always reports sRGB07, Displays and environments
More or less contrast? Forced colors?@media (prefers-contrast: more), (forced-colors: active)matchMedia()Widely available08, Color for people
Less transparency?@media (prefers-reduced-transparency: reduce)matchMedia()Chromium only08, Color for people
Let the reader pick a color?<input type="color">the EyeDropper API, where presentThe input in every browser; EyeDropper in desktop Chromium only03, Color in CSS

Color taught elsewhere

Other sections introduce tools these pages build on: