Docs / Theming
Light, dark, and you
Every component works in both modes. Here’s how they decide which one they’re in, and how to let visitors choose.
How components pick a mode
Neutral colours use Tailwind’s dark: variant — bg-[#0a0a0a] dark:bg-[#f5f5f5], for example. By default Tailwind applies dark: when the visitor’s system is in dark mode, so the components follow it with no setup.
Colourful components (Lava Lamp, Confetti Button and friends) keep their colours in both modes, on purpose.
Letting visitors choose
To add a manual switch, tell Tailwind that dark: should also respond to a data-theme attribute on <html>. In your main CSS file:
@custom-variant dark {
&:where([data-theme="dark"], [data-theme="dark"] *) { @slot; }
@media (prefers-color-scheme: dark) {
&:where(:root:not([data-theme="light"]), :root:not([data-theme="light"]) *) { @slot; }
}
}Now data-theme="dark" forces dark, data-theme="light" forces light, and no attribute follows the system.
The Pour Toggle
The Pour Toggle sets that attribute for you, remembers the choice, and animates the switch. Drop it in your header, and add this to <head> so a saved theme applies before the first paint:
<script dangerouslySetInnerHTML={{ __html:
`try{var t=localStorage.getItem("theme");if(t==="dark"||t==="light")document.documentElement.setAttribute("data-theme",t)}catch(e){}`
}} />With Next.js, also add suppressHydrationWarning to your <html> tag.
Changing colours
Every component is yours once it’s copied — change the hex values directly, or swap them for your own Tailwind theme colours (for examplebg-[#0a0a0a] → bg-foreground).