Install mode-watcher
npm install mode-watcher
See Mode Watcher for details.
Docs
Dark Mode
Adding dark mode to your site using mode-watcher.
Usage
Install mode-watcher
npm install mode-watcher
See Mode Watcher for details.
Add ModeWatcher component
Add the <ModeWatcher /> component to your root layout file.
+layout.svelte
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
That's it!
Use the toggleMode function and $mode to toggle:
Svelte Code
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |