status-desktop/devuser_guide/assets/js/darkmode.js

13 lines
300 B
JavaScript
Raw Normal View History

2021-05-07 16:15:41 +00:00
document.getElementById('mode').addEventListener('click', () => {
document.body.classList.toggle('dark');
localStorage.setItem('theme', document.body.classList.contains('dark') ? 'dark' : 'light');
});
if (localStorage.getItem('theme') === 'dark') {
document.body.classList.add('dark');
}