Skip to content

Commit

Permalink
Theme Init Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
haydncomley committed Jun 12, 2024
1 parent cd9b4ec commit be2fb3a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/example/src/pages/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit be2fb3a

Please sign in to comment.