


@wrksz/themes
Drop-in replacement for next-themes. React 19 hydration fixed, full TypeScript types, zero dependencies.
Using an AI agent? Set it up with one prompt
Features

React 19 ready
Fixes the inline script warning,
Activity/cacheComponentsstale theme, and the__nameminification bug.
Drop-in replacement
Same API as
next-themes. Change one import.
Hybrid storage
Use
storage="hybrid"for cookie-first SSR correctness plus cross-tab sync vialocalStorage.
Nested providers
Independent theme instances per section. No shared state between them.

Full type safety
createThemes(...)infers your theme union once and typesuseTheme,useThemeValue, andsetThemeeverywhere.
Zero runtime deps
No runtime dependencies. A tiny inline script plus React hooks, nothing more.
Use with agents
Set up themes in your project
A ready prompt that points your agent at the agent guide. Paste it into Claude Code, Codex or any agent working in your repository.
Coming from next-themes? The migration guide has a prompt for that.
Comparison
next-themes still has React 19 bugs open.
| Feature | next-themes | @wrksz/themes |
|---|---|---|
| React 19 script warning | Bug | Fixed (useServerInsertedHTML)Fixed |
| __name minification bug | Bug | FixedFixed |
| React 19 Activity / cacheComponents stale theme | Bug | Fixed (useSyncExternalStore)Fixed |
| Multiple classes per theme | Bug | Fixed (correct class removal)Fixed |
| Nested providers | No | per-instance storeYes |
| sessionStorage support | No | YesYes |
| cookie storage (zero-flash SSR) | No | storage="cookie"Yes |
| Disable storage | No | storage="none"Yes |
| meta theme-color support | No | themeColor propYes |
| Server-provided theme | No | initialTheme propYes |
| Always follow system preference | No | followSystem propYes |
| disableTransitionOnChange per property | No | CSS string + inline scriptYes |
| Read theme outside React | No | getTheme()Yes |
| Generic types | No | useTheme<AppTheme>()Yes |
| Zero runtime dependencies | YesYes | YesYes |
Roadmap

Framework agnostic
Remix, Vite, SvelteKit, and other React-based frameworks.

More features
More storage adapters and finer-grained resolution options.

Open to contributions
Bug reports, feature requests, and PRs are welcome on GitHub.
Contributors
Every release and who shipped it is in the changelog.
Sponsors
Crafted down to the last detail.
Want your company here? Sponsor on GitHub
@wrksz/themes