dsql-admin/dsql-app/public/scripts/themeSelector.js
2024-11-05 12:12:42 +01:00

17 lines
447 B
JavaScript
Executable File

// @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";
}