summaryrefslogtreecommitdiff
path: root/assets/js/theme.js
blob: 9f1660ce31f4fc6d04296b394734d31cf3911ce8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"use strict"
const THEME_KEY = "data-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();
}

function setThemeExtend() {
    document.documentElement.setAttribute("data-extended-theme", "true")
}

updateTheme();