summaryrefslogtreecommitdiff
path: root/js/toggleTheme.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/toggleTheme.ts')
-rw-r--r--js/toggleTheme.ts15
1 files changed, 5 insertions, 10 deletions
diff --git a/js/toggleTheme.ts b/js/toggleTheme.ts
index fd15dae..733a0f3 100644
--- a/js/toggleTheme.ts
+++ b/js/toggleTheme.ts
@@ -1,17 +1,12 @@
/// <reference path="setTheme.ts" />
function toggleTheme() {
- let theme = localStorage.getItem("theme");
+ let theme: Theme = JSON.parse(localStorage.getItem("theme")!);
- if (theme == "light") {
- theme = "dark";
- } else if (theme == "dark") {
- theme = "light";
- } else {
- console.log!("invalid theme `" + theme + "`");
-
- // Use default:
- theme = "dark";
+ if (theme == Theme.Light) {
+ theme = Theme.Dark;
+ } else if (Theme.Dark) {
+ theme = Theme.Light;
}
setTheme(theme);