aboutsummaryrefslogtreecommitdiff
path: root/static/js/theme_button.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/theme_button.js')
-rw-r--r--static/js/theme_button.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/static/js/theme_button.js b/static/js/theme_button.js
new file mode 100644
index 0000000..b03f17f
--- /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('switch');
+ localStorage.setItem('theme', document.documentElement.classList.contains('switch') ? 'switch' : 'default');
+ });
+}