dsql-admin/dsql-app/public/scripts/themeSelector.js

17 lines
447 B
JavaScript
Raw Permalink Normal View History

2024-11-05 11:12:42 +00:00
// @ts-check
////////////////////////////////////////
let existingTheme = localStorage.getItem("theme");
////////////////////////////////////////
if (!existingTheme) {
localStorage.setItem("theme", "light");
existingTheme = "light";
} else if (existingTheme?.match(/dark/)) {
document.documentElement.className = "dark";
} else if (existingTheme?.match(/light/)) {
document.documentElement.className = "light";
}