diff options
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/theme.js | 16 |
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 |