1
0
mirror of https://github.com/kognise/water.css.git synced 2025-08-18 19:02:05 +02:00

Add theme switcher

This commit is contained in:
Kognise
2019-04-05 09:09:13 -04:00
parent 22cae7e386
commit aabd59c3ea
3 changed files with 17 additions and 6 deletions

11
docs/script.js Normal file
View File

@@ -0,0 +1,11 @@
document.getElementById('switch').addEventListener('click', () => {
const { body } = document
const ph = document.getElementById('ph')
if (body.className) {
body.className = ''
ph.src = ph.src.replace('theme=light', 'theme=dark')
} else {
body.className = 'light'
ph.src = ph.src.replace('theme=dark', 'theme=light')
}
})