14 lines
377 B
JavaScript
14 lines
377 B
JavaScript
(function () {
|
|
try {
|
|
var saved = localStorage.getItem("ui-theme");
|
|
var theme =
|
|
saved === "dark" || saved === "light"
|
|
? saved
|
|
: window.matchMedia &&
|
|
window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
? "dark"
|
|
: "light";
|
|
document.documentElement.setAttribute("data-theme", theme);
|
|
} catch (e) {}
|
|
})();
|