diff options
Diffstat (limited to 'js/setTheme.ts')
-rw-r--r-- | js/setTheme.ts | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/js/setTheme.ts b/js/setTheme.ts deleted file mode 100644 index 25debba..0000000 --- a/js/setTheme.ts +++ /dev/null @@ -1,24 +0,0 @@ -enum Theme { - Light, - Dark, -} - -function setTheme(theme: Theme) { - let is_valid_theme = - theme == Theme.Light - || theme == Theme.Dark; - - if (!is_valid_theme) { - console.log("invalid theme \"" + theme + "\""); - - // Use default: - theme = Theme.Dark; - } - - console.log("setting theme to `" + Theme[theme] + "`"); - - let body = document.getElementById("body")!; - body.setAttribute("data-theme", Theme[theme]); - - localStorage.setItem("theme", JSON.stringify(theme)); -} |