summaryrefslogtreecommitdiff
path: root/assets/js/theme.js
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-09-07 18:10:54 +0200
committerBotond Hende <nettingman@gmail.com>2024-09-07 18:10:54 +0200
commitb982508df0c4514544c1c5b0fff2573147d34e67 (patch)
tree94ae75aa01ee96d09bcbbf6797d8846db3fdff70 /assets/js/theme.js
parentdecab05a85ea33eeffe75b6275678463277576b6 (diff)
light theme support
Diffstat (limited to 'assets/js/theme.js')
-rw-r--r--assets/js/theme.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/assets/js/theme.js b/assets/js/theme.js
new file mode 100644
index 0000000..ffb6d48
--- /dev/null
+++ b/assets/js/theme.js
@@ -0,0 +1,16 @@
+"use strict"
+const THEME_KEY = "used-theme";
+
+function updateTheme() {
+ let theme = localStorage.getItem(THEME_KEY);
+ if (theme != null) {
+ document.documentElement.setAttribute(THEME_KEY, theme)
+ }
+}
+
+function setTheme(theme) {
+ localStorage.setItem(THEME_KEY, theme);
+ updateTheme();
+}
+
+updateTheme(); \ No newline at end of file