Make sure default theme is set for the end-user

This commit is contained in:
Korbs 2024-10-25 15:20:25 -04:00
parent fdc04643bb
commit 69f192cc36
2 changed files with 7 additions and 4 deletions

View file

@ -3,13 +3,14 @@
import { Tooltips } from 'astro-tooltips' import { Tooltips } from 'astro-tooltips'
// User Configuration // User Configuration
if (Astro.cookies.get("Theme").value === "Light") { if (Astro.cookies.get("Theme") === undefined) {
Astro.cookies.set("Theme", "Dark")
} else if (Astro.cookies.get("Theme").value === "Light") {
var ThemeScheme = 'light' var ThemeScheme = 'light'
} else if (Astro.cookies.get("Theme").value === "Dark") { } else if (Astro.cookies.get("Theme").value === "Dark") {
var ThemeScheme = 'dark' var ThemeScheme = 'dark'
}else if (Astro.cookies.get("Theme").value === undefined) {
var ThemeScheme = 'dark'
} }
console.log(Astro.cookies.get("Theme"))
--- ---
<head> <head>

View file

@ -12,7 +12,9 @@ import '@styles/index.scss'
import '@styles/mobile.scss' import '@styles/mobile.scss'
// User Configuration // User Configuration
if (Astro.cookies.get("Theme").value === "Light") { if (Astro.cookies.get("Theme") === undefined) {
Astro.cookies.set("Theme", "Dark")
} else if (Astro.cookies.get("Theme").value === "Light") {
var ThemeScheme = 'light' var ThemeScheme = 'light'
} else if (Astro.cookies.get("Theme").value === "Dark") { } else if (Astro.cookies.get("Theme").value === "Dark") {
var ThemeScheme = 'dark' var ThemeScheme = 'dark'