Alpha: Ships on npm at 7.0.0-alpha.07.0.0-alpha.0

Dark mode

Light is the full palette on :root. Dark redefines only the roles that change, under the reader's prefers-color-scheme.

What each Theme emits

ThemeDark paletteschemeDocument color-scheme
certificateyesautolight dark
vaultlinenoautolight
quaypointyeslightlight
callboardyeslightlight
directoryyesautolight dark
  • certificate and directory emit dark. The page follows the reader's scheme.
  • quaypoint and callboard declare a dark palette and set scheme: 'light'. compileTheme checks the palette and emits none of it.
  • vaultline declares no dark palette. Its page is light in every scheme.

See it

Pick a Theme. Where it emits dark, the toggle swaps between its two real renders: the dark one is the build's twin with the Theme's own dark media query switched on. Where it does not, the page shows the declared palette as values and draws no dark render.

Emits light and dark
The dark render of Vanroster › home under certificate. It is the Theme’s own dark media query, switched on; nothing is inverted.

The rules

  • No color gets its only definition inside the dark media query. Every role has a light value first.
  • An invariant role is declared once and never redefined for dark. compileTheme refuses one that appears in dark. The code window is dark in both schemes.
  • scheme: 'light' keeps the dark palette declared and checked, and emits none of it. Changing that one word to auto turns dark mode on.
  • The document's color-scheme is light dark when the Theme emits a dark palette, and light otherwise.

Previews on these docs

Every preview on these docs follows the same rule. The scheme control is on only for certificate and directory, and it swaps to the dark twin; for the other three it stays off, with "Light only by this Theme's policy". No preview inverts a light render.

On this page