1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-11-09 20:00:12 +00:00
jfa-go/ts/modules/theme.ts
Harvey Tindall 29fafba035
remove custom css and bootstrap related options
i may reimplement custom css later as an additive version where their
file is loaded on top of a17t.css later, but for now its not a priority.
2021-01-03 21:13:37 +00:00

17 lines
676 B
TypeScript

export function toggleTheme() {
document.documentElement.classList.toggle('dark-theme');
document.documentElement.classList.toggle('light-theme');
localStorage.setItem('theme', document.documentElement.classList.contains('dark-theme') ? "dark" : "light");
}
export function loadTheme() {
const theme = localStorage.getItem("theme");
if (theme == "dark") {
document.documentElement.classList.add('dark-theme');
document.documentElement.classList.remove('light-theme');
} else if (theme == "light") {
document.documentElement.classList.add('light-theme');
document.documentElement.classList.remove('dark-theme');
}
}