1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-11-12 21:30:10 +00:00
jfa-go/ts/modules/theme.ts

13 lines
488 B
TypeScript
Raw Normal View History

2020-12-28 19:56:11 +00:00
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() {
if (localStorage.getItem('theme') == "dark") {
document.documentElement.classList.add('dark-theme');
document.documentElement.classList.remove('light-theme');
}
}