How to detect Dark Mode reactively? #1274
-
I'm using the DarkMode button in my project. Is there another way to detect that the dark mode was changed without modifying the Darkmode button to use a store instead of localStorage? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I ended up wrapping my DarkMode component inside another component which installs a MutationObserver and updates a svelte store:
|
Beta Was this translation helpful? Give feedback.
I ended up wrapping my DarkMode component inside another component which installs a MutationObserver and updates a svelte store: