Class-based dark mode in Next.js often flashes the wrong theme on first load. And if you've tried to let a product pick a brand color β indigo today, emerald tomorrow β you've probably chased utilities like bg-indigo-600 through a dozen files.
Here's a pattern that keeps all of that in one place, using Next.js 16 (App Router) and Tailwind CSS v4:
Design tokens live in a single CSS file, written in OKLCH
Tailwind reads those tokens through @theme inline , so utilities like bg-primary always follow the active theme
Accent presets are just a data-accent attribute on <html>
An inline script in the root layout applies the stored theme and accent before the first paint
A small React provider lets a toggle and a color picker update both at runtime
The snippets below are from Signal UI Kit, a Next.js 16 starter theme I built. The same structure works in any App Router project.
Keep tokens in one CSS file
Every color, radius, shadow, and motion token lives in styles/theme.css .β¦