Skip to content

Dark mode

Semantic tokens are declared once via light-dark() and dark mode flips them to Flexoki’s inverted ramppaper ↔ black, base-50 ↔ base-950, accent -600 ↔ -400.

Mode is resolved from CSS color-scheme at :root:

Selectorcolor-schemeWhen it wins
:rootlight darkdefault — follows the OS
[data-theme="light"]lightforces light
[data-theme="dark"]darkforces dark

color-scheme also flips native form controls, scrollbars, and the page background before paint, so there’s no flash on load.

Set data-theme on <html> to override the OS preference:

<html data-theme="dark">
...
</html>
<html data-theme="light">
...
</html>

The selector isn’t scoped to :root, so any element can flip its own subtree — useful for a dark hero on an otherwise light page:

<section data-theme="dark">
<!-- everything inside renders in dark mode -->
</section>

The dark: variant fires under prefers-color-scheme: dark or inside [data-theme="dark"], and is suppressed inside [data-theme="light"]:

<div class="shadow-md dark:shadow-xl">...</div>