From 4e30ae95eaf52a7f427bdf020d118f40e00ab291 Mon Sep 17 00:00:00 2001 From: Zach Berwaldt Date: Mon, 9 Oct 2023 13:41:04 -0400 Subject: add some homemade svg, wpartials, and darkmode --- assets/js/darkmode.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 assets/js/darkmode.js (limited to 'assets/js/darkmode.js') diff --git a/assets/js/darkmode.js b/assets/js/darkmode.js new file mode 100644 index 0000000..c6094d0 --- /dev/null +++ b/assets/js/darkmode.js @@ -0,0 +1,11 @@ +// get with web apis #fullscren element and on click toggle fullscreen +const darkmode = document.getElementById('darkmode'); +const html = document.querySelector('html'); +darkmode.addEventListener('click', () => { + if (html.dataset.theme === 'dark') { + html.dataset.theme = 'light'; + } else { + html.dataset.theme = 'dark'; + } +}); + -- cgit v1.1