From be2fb3a8af2ecdfd64fa0f9db2c5e06145320f8e Mon Sep 17 00:00:00 2001 From: Haydn Comley Date: Wed, 12 Jun 2024 13:27:03 +0100 Subject: [PATCH] Theme Init Fix --- src/example/src/pages/[...slug].astro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/example/src/pages/[...slug].astro b/src/example/src/pages/[...slug].astro index 6d5e4ef..47b0a34 100644 --- a/src/example/src/pages/[...slug].astro +++ b/src/example/src/pages/[...slug].astro @@ -6,7 +6,8 @@ import { colors } from "../components/colour-picker.ts"; import { hexToRgb, shiftHue } from "../lib/utils"; const path = Astro.url.pathname; -const theme = Astro.cookies.get("theme")?.value || colors[0].hex; +const theme = Astro.cookies.get("theme")?.value || "#dd1364"; +console.log("Hello", theme); const app = myApp({ path, theme })!; const primary = hexToRgb(theme); @@ -38,8 +39,7 @@ const secondary = shiftHue(hexToRgb(theme), 0.2); document.cookie .split("; ") .find((row) => row.startsWith("theme=")) - ?.split("=")[1] ?? - getComputedStyle(document.body).getPropertyValue("--theme-primary"); + ?.split("=")[1] ?? "#dd1364"; const app = myApp({ path, theme })!; app.hydrate(app!.id);