summaryrefslogtreecommitdiffstats
path: root/apps/projects/src/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'apps/projects/src/index.html')
-rw-r--r--apps/projects/src/index.html11
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/projects/src/index.html b/apps/projects/src/index.html
index 985b62b..22dba4f 100644
--- a/apps/projects/src/index.html
+++ b/apps/projects/src/index.html
@@ -26,11 +26,18 @@
<link rel="icon"
href="./_assets/pwa/favicon.svg">
<script>
- const currentTheme = localStorage.getItem("theme");
+ 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 {
+ } 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";
}
</script>
<link rel="stylesheet"