mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 03:09:14 +08:00
fix: auto thme
This commit is contained in:
parent
ff79054692
commit
596b07ee2d
@ -19,7 +19,7 @@ export const Route = createRootRouteWithContext<{
|
|||||||
beforeLoad: () => {
|
beforeLoad: () => {
|
||||||
const theme = localStorage.getItem("color-scheme") || "auto"
|
const theme = localStorage.getItem("color-scheme") || "auto"
|
||||||
const isDark = window.matchMedia("(prefers-color-scheme: dark)").matches
|
const isDark = window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||||
if (!theme ? isDark : theme === "dark") {
|
if (theme === "auto" ? isDark : theme === "dark") {
|
||||||
document.documentElement.classList.add("dark")
|
document.documentElement.classList.add("dark")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user