Theming
Kuzenbo’s theme system provides semantic tokens that stay consistent across light and dark mode, with prebuilt themes and full customization support.Theme runtime overview
The@kuzenbo/theme package provides:
- ThemeProvider - React context for theme state management
- ThemeBootstrapScript - Prevents flash of unstyled content
- Semantic tokens - Color variables that adapt to light/dark mode
- Prebuilt themes - 75+ ready-to-use theme variations
Basic setup
Import a prebuilt theme
Import one of the prebuilt theme CSS files:Available prebuilt themes include:
app.tsx
kuzenbo, dracula, nord, rose, forest, ocean, cyberpunk, and 60+ more.Add ThemeBootstrapScript
The bootstrap script prevents theme flashing by applying the theme before React hydrates:
app.tsx
Place
ThemeBootstrapScript before your app content to ensure it runs first.Theme provider configuration
TheThemeProvider accepts several configuration options:
ThemeProvider props
Default theme to use. Options:
"light", "dark", or "system".HTML attribute to use for theme. Use
"class" to toggle .dark class on root.Enable system theme detection via
prefers-color-scheme.localStorage key for persisting theme preference.
Disable CSS transitions when switching themes to prevent jarring animations.
Theme bootstrap script
TheThemeBootstrapScript component injects an inline script that:
- Reads theme preference from cookies or localStorage
- Detects system theme via
prefers-color-scheme - Applies the correct theme class before React hydrates
- Syncs theme state between cookie and localStorage
Bootstrap script options
Using semantic tokens
Kuzenbo provides semantic color tokens that automatically adapt to the current theme:Background tokens
Foreground tokens
Accent tokens
Border and input tokens
Semantic status tokens
Prebuilt themes
Kuzenbo includes 75+ prebuilt themes. Import any theme CSS file:Available themes
Prebuilt themes include:acid, amber, amethyst, azure, ballet, berry, blood, blush, bubblegum, choco, citrine, clown, coffee, coral, cream, cyberpunk, dracula, dusty, forest, glass, glitch, graphite, harvest, hematite, high-contrast, indigo, inferno, jade, jasper, kuzenbo, lagoon, lapis, lavender, lsd, malachite, matrix, mauve, midnight, mint, mono, neon, noir, nord, obsidian, ocean, onyx, paper, pastel, peaches, peridot, powder, retro, rose, sakura, sandstone, sapphire, slate, slime, solar, sunset, terracotta, toxic, turquoise, twilight, ufo, vanilla, vaporwave, vintage, warm, warning, and zen.
Theme constants
The theme package exports useful constants for building custom theme utilities:Theme utilities
The theme package provides utility functions for advanced use cases:Parse theme preference
Read theme from cookie
Apply theme to root
Next steps
Styling
Learn about the styling system and customization.
Custom themes
Create your own custom theme.