@wrksz/themes
Modern theme management for Next.js 16+ and React 19+. Fixes every known bug in next-themes and adds the features that were missing.
Everything next-themes should have been
Bug fixes and new features, zero API changes.
React 19 ready
Fixes the inline script warning, Activity/cacheComponents stale theme, and the __name minification bug.
Drop-in replacement
Same API as next-themes. Swap the import and you are done. No migration needed.
Nested providers
Independent theme instances per section. Each provider manages its own state with a per-instance store.
Full type safety
Generic useTheme<AppTheme>() constrains setTheme to your exact theme union. No casting needed.
Flexible storage
localStorage, sessionStorage, or none. Disable persistence for forced or server-driven themes.
Zero runtime deps
No runtime dependencies. Ships only what the browser needs: a tiny inline script and React hooks.
Why not next-themes?
43 open issues, 16 open PRs, React 19 bugs unresolved.
| 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 |
| Disable storage | No | storage="none"Yes |
| meta theme-color support | No | themeColor propYes |
| Server-provided theme | No | initialTheme propYes |
| Generic types | No | useTheme<AppTheme>()Yes |
| Zero runtime dependencies | YesYes | YesYes |
What's next
The library is actively developed and growing.
Framework agnostic
Remix, Vite, SvelteKit, and any React-based framework. Not just Next.js.
More features
New APIs, more storage adapters, and deeper control over theme resolution.
Open to contributions
Bug reports, feature requests, and PRs are welcome on GitHub.