svelte-theme-switch
SvelteKit had no next-themes, so I ported it. System preference detection, SSR-safe persistence and per-route forced themes.
Overview
A published npm library that ports the next-themes API to SvelteKit. Provides system preference detection via prefers-color-scheme, SSR-safe theme persistence using localStorage, and the ability to force a specific theme per route — all as a drop-in dark/light mode solution for Svelte developers.
Problem
Placeholder — describe the ecosystem gap: SvelteKit had no equivalent of next-themes. Developers were either hand-rolling flash-of-wrong-theme bugs or copy-pasting fragile snippets that broke on SSR.
Solution
Placeholder — describe the implementation: how SSR safety was achieved (avoiding window during server render), how CSS custom properties are toggled, how the Svelte store architecture maps to next-themes' context API, and how forced-per-route theming is handled.
Outcome
Placeholder — describe adoption: npm download stats, GitHub stars, any community feedback or PRs received, and what made the library a reliable drop-in compared to alternatives.