1
0
Fork 0
forked from mCaptcha/website
mcaptcha-website/assets/js/darkmode.js

13 lines
300 B
JavaScript
Raw Normal View History

2021-03-09 18:56:02 +05:30
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');
}