@wrksz/themes
A drop-in replacement for next-themes, the theme library with 22 million weekly downloads that hadn't shipped in a year. The same props and hooks, its open bugs fixed, and cookie storage and typed themes on top.
- Role
- Design and code
- Year
- 2026
- Type
- Open source
- Version
- 2.0.0
Brief
By March 2026, next-themes hadn't shipped a release in a year, with 44 open issues and 17 pull requests waiting for review. While I was moving Hostero to Next.js 16 and React 19, it started warning about its inline script on every render.
I opened a pull request to fix it, looked at how active the repository was, and decided a proper rewrite of a 300-line library made more sense than maintaining a fork. The warning turned out to be one of four problems.
Decisions
The script outside the tree
The blocking script is injected with useServerInsertedHTML instead of rendering inside a Client Component, so React 19 stops warning on every render.
A store per provider
The theme lives in a store read through useSyncExternalStore, so it never sticks on a stale value under cacheComponents, and nested providers can run different themes on one page.
Cookies without a flash
With cookie storage, the bootstrap script reads the theme before the first paint, and nothing reads cookies on the server, so the layout can stay static.
Since then
0.1.0 reached npm the day after the pull request. 1.0.0 shipped in July with a 46% smaller package, the first outside contributor came in August, and 2.0.0 followed in September. The pull request to next-themes is still open.