diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-09-20 09:24:27 +0200 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-09-20 09:24:27 +0200 |
| commit | a9072370ca1eb9a5cce928b1d487db0f307edea6 (patch) | |
| tree | 59c3c23df930a8b5f888dc7813923abf4ceefed4 /apps/kit/static/preload.js | |
| parent | 56fa963a1d63cbe0bf28e29e717cceaa417c45c1 (diff) | |
| download | greatoffice-a9072370ca1eb9a5cce928b1d487db0f307edea6.tar.xz greatoffice-a9072370ca1eb9a5cce928b1d487db0f307edea6.zip | |
feat: Move old apps into it's own directory
Diffstat (limited to 'apps/kit/static/preload.js')
| -rw-r--r-- | apps/kit/static/preload.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/kit/static/preload.js b/apps/kit/static/preload.js new file mode 100644 index 0000000..379902f --- /dev/null +++ b/apps/kit/static/preload.js @@ -0,0 +1,13 @@ +const value = `; ${document.cookie}`; +const parts = value.split(`; go_theme=`); +let currentTheme = "system"; +if (parts.length === 2) { + currentTheme = parts.pop().split(";").shift(); +} +if (currentTheme === "light") { + document.querySelector("html").dataset.theme = "light"; +} else if (currentTheme === "dark") { + document.querySelector("html").dataset.theme = "dark"; +} else { + document.querySelector("html").dataset.theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; +}
\ No newline at end of file |
