23 lines
792 B
JavaScript
23 lines
792 B
JavaScript
(() => {
|
|
let theme: string | null = null;
|
|
let defaultDark = false;
|
|
let navbarColor: string | null = null;
|
|
let navbarTextColor: string | null = null;
|
|
try {
|
|
theme = localStorage.getItem("theme");
|
|
const dd = document.querySelector('meta[name="theme-default-dark"]');
|
|
defaultDark = dd ? dd.getAttribute("content") === "true" : false;
|
|
navbarColor = localStorage.getItem("navbarColor");
|
|
navbarTextColor = localStorage.getItem("navbarTextColor");
|
|
} catch (_e) {}
|
|
if (theme === "dark" || (!theme && defaultDark))
|
|
document.documentElement.classList.add("dark");
|
|
if (navbarColor)
|
|
document.documentElement.style.setProperty("--color-navbar", navbarColor);
|
|
if (navbarTextColor)
|
|
document.documentElement.style.setProperty(
|
|
"--color-navbar-text",
|
|
navbarTextColor,
|
|
);
|
|
})();
|