Skip to content

Commit

Permalink
fix: no colors when signed out
Browse files Browse the repository at this point in the history
  • Loading branch information
manankarnik committed Feb 12, 2024
1 parent 882f781 commit 854b3d8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ export const load: LayoutServerLoad = async (event) => {
secondary: user?.secondary
};
}
return {
primary: "fuchsia",
secondary: "violet"
};
};
19 changes: 19 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@
import LoadingBar from "$lib/components/loading-bar.svelte";
import BackgroundGradient from "$lib/components/background-gradient.svelte";
import GithubRibbon from "$lib/components/github-ribbon.svelte";
import { page } from "$app/stores";
import { browser } from "$app/environment";
import { mode } from "mode-watcher";
import colors from "tailwindcss/colors";
if (browser) {
document
.querySelector(":root")
.style.setProperty(
"--primary-color",
colors[$page.data.primary][$mode == "dark" ? 600 : 500]
);
document
.querySelector(":root")
.style.setProperty(
"--secondary-color",
colors[$page.data.secondary][$mode == "dark" ? 600 : 500]
);
}
</script>

<BackgroundGradient />
Expand Down

0 comments on commit 854b3d8

Please sign in to comment.