diff options
Diffstat (limited to 'js/setTheme.ts')
-rw-r--r-- | js/setTheme.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/js/setTheme.ts b/js/setTheme.ts new file mode 100644 index 0000000..d9a6cf8 --- /dev/null +++ b/js/setTheme.ts @@ -0,0 +1,8 @@ +function setTheme(theme: string) { + console.log("setting theme to `" + theme + "`"); + + let body = document.getElementById("body")!; + body.setAttribute("data-theme", theme); + + localStorage.setItem("theme", theme); +} |