Docs

mode-watcher

Dark mode for SvelteKit.

What is mode-watcher

mode-watcher manages light/dark mode in SvelteKit without the flash of the wrong theme on load.

Install

npm
bash
npm install mode-watcher

Usage

svelte
svelte
<script>
  import { ModeWatcher, toggleMode } from 'mode-watcher';
</script>
<ModeWatcher />
<button onclick={toggleMode}>Toggle theme</button>

Docs

Official documentation: mode-watcher.