Theming

Switch skins, colour modes and accents with three attributes, and override any token.

Three attributes on <html> drive the whole system:

  • data-skin — surface, linen, studio, paper, minimalist or neumorphism.
  • data-theme — light, dark or system (no attribute also follows the system).
  • data-accent — blue, teal, green, orange or pink; no attribute uses the skin's own accent.
html
<html lang="en" data-skin="surface" data-theme="dark" data-accent="teal">

Avoid a flash of the wrong theme

Set the attributes before the first paint with a tiny inline script in index.html:

html
<script>
  try {
    const s = JSON.parse(localStorage.getItem("theme") ?? "{}");
    const r = document.documentElement;
    r.dataset.skin = s.skin ?? "surface";
    if (s.mode) r.dataset.theme = s.mode;
    if (s.accent) r.dataset.accent = s.accent;
  } catch {}
</script>

Override tokens

Every visual decision is a custom property. Re-declare one under the same selector to change it everywhere:

css
:root[data-skin="surface"] {
  --radius: 1rem;
  --font-sans: "Figtree", system-ui, sans-serif;
}

:root[data-skin="surface"][data-theme="dark"] {
  --surface-base: oklch(18% 0.01 260);
}

See every token, live, on the Theme page.