diff --git a/docs/script.js b/docs/script.js index 0c34b6b..ea670de 100644 --- a/docs/script.js +++ b/docs/script.js @@ -1,11 +1,11 @@ document.getElementById('switch').addEventListener('click', () => { const { body } = document const ph = document.getElementById('ph') - if (body.className) { - body.className = '' + if (body.classList.contains('light')) { + body.classList.remove('light') ph.src = ph.src.replace('theme=light', 'theme=dark') } else { - body.className = 'light' + body.classList.add('light') ph.src = ph.src.replace('theme=dark', 'theme=light') } }) \ No newline at end of file