From b982508df0c4514544c1c5b0fff2573147d34e67 Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Sat, 7 Sep 2024 18:10:54 +0200 Subject: light theme support --- assets/js/theme.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 assets/js/theme.js (limited to 'assets/js/theme.js') 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 -- cgit v1.2.3-70-g09d2