Add prefers-dark-theme

compressed-week-view
Francesco Minnocci 2 years ago
parent 0e81edfa3b
commit 09ebad224b
Signed by untrusted user: BachoSeven
GPG Key ID: 2BE4AB7FDAD828A4

@ -103,11 +103,12 @@ const App = ({}) => {
setEventi(eventi)
}, [source])
const [theme, setTheme] = useState(localStorage.getItem("theme") ?? "light")
const [theme, setTheme] = useState(localStorage.getItem("theme") ?? (window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark" : "light"))
document.body.classList.toggle("dark-mode", theme === "dark")
localStorage.setItem("theme", theme)
return (
<>
<Toolbar

Loading…
Cancel
Save