Theming
Class-based dark mode with a no-flash inline script, system preference support, and a ready-made toggle.
Try it
Current theme
Preference: system · Resolved: light
Setup
Wrap your app once. ThemeScript applies the stored theme before first paint so there is no flash of the wrong mode.
Reading and setting the theme
How it works
- Dark mode is the
.darkclass on<html>— every semantic token swaps automatically. - The preference persists in
localStorageundertra-theme. systemtracks the OS and updates live when the OS preference changes.- Components built with semantic tokens (
bg-canvas,text-ink,border-line) never needdark:overrides.