From 3af6d9131f6dfc138856d718ec96626344095ec8 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Mon, 22 May 2023 23:24:44 -0700 Subject: Optimizations and Fixes --- static/js/theme_button.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 static/js/theme_button.js (limited to 'static/js/theme_button.js') diff --git a/static/js/theme_button.js b/static/js/theme_button.js new file mode 100644 index 0000000..34d1d78 --- /dev/null +++ b/static/js/theme_button.js @@ -0,0 +1,7 @@ +// Set lightmode +if (document.getElementById('mode')) { + document.getElementById('mode').addEventListener('click', () => { + document.documentElement.classList.toggle('light'); + localStorage.setItem('theme', document.documentElement.classList.contains('light') ? 'light' : 'dark'); + }); +} -- cgit v1.3.1