From 887764dfa8ef2fd3bf7c0b7847b08b2d42332dec Mon Sep 17 00:00:00 2001 From: Rich V Date: Sun, 6 Feb 2022 14:01:59 -0600 Subject: [PATCH] Initialize dark-mode via prefers-color-scheme --- src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.js b/src/App.js index 3f8fdc8..6264405 100644 --- a/src/App.js +++ b/src/App.js @@ -123,7 +123,7 @@ function App() { setInfoModalIsOpen(false) } - const [darkMode, setDarkMode] = useLocalStorage('dark-mode', false) + const [darkMode, setDarkMode] = useLocalStorage('dark-mode', window.matchMedia('(prefers-color-scheme: dark)').matches) const toggleDarkMode = () => { setDarkMode((prev) => !prev) }