From 2650d024db39964f42e15bb0629210f22b40ecaa Mon Sep 17 00:00:00 2001 From: pancakes Date: Fri, 13 Dec 2024 01:03:14 +1000 Subject: [PATCH] Add back green theme --- src/routes/+layout.server.js | 7 +++++ src/routes/+layout.svelte | 5 +++ src/routes/green/+page.server.js | 13 ++++++++ static/assets/green.css | 53 ++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 src/routes/+layout.server.js create mode 100644 src/routes/green/+page.server.js create mode 100644 static/assets/green.css diff --git a/src/routes/+layout.server.js b/src/routes/+layout.server.js new file mode 100644 index 0000000..94490b7 --- /dev/null +++ b/src/routes/+layout.server.js @@ -0,0 +1,7 @@ +export async function load({ cookies }) { + const green = cookies.get("green"); + + return { + green: green === "true" + }; +} \ No newline at end of file diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 0101823..889ba69 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -3,9 +3,14 @@ import Footer from "$lib/components/Footer.svelte"; import Navbar from "$lib/components/Navbar.svelte"; import "./style.css"; + + export let data; + {#if data.green} + + {/if} {$page.data.title ? $page.data.title + " | pancakes" : "pancakes"} diff --git a/src/routes/green/+page.server.js b/src/routes/green/+page.server.js new file mode 100644 index 0000000..422ecfe --- /dev/null +++ b/src/routes/green/+page.server.js @@ -0,0 +1,13 @@ +import { redirect } from '@sveltejs/kit'; + +export async function load({ cookies }) { + const green = cookies.get("green"); + + if (green === "true") { + cookies.delete("green", { path: "/" }); + } else { + cookies.set("green", "true", { path: "/", sameSite: "strict" }); + } + + redirect(302, "/"); +} diff --git a/static/assets/green.css b/static/assets/green.css new file mode 100644 index 0000000..e7d5b9d --- /dev/null +++ b/static/assets/green.css @@ -0,0 +1,53 @@ +:root { + --accent: #b0a64e !important; + --accent-2: #b0a64e !important; + --background: #4c5844 !important; + --background-2: #3e4637 !important; + --foreground: #a2a09c !important; + --success: #B0F950 !important; + --warn: #ffff00 !important; + --error: #AD4547 !important; + + --radius: 0px !important; +} + +h1 { + color: var(--accent) !important; + border-bottom: none !important; +} + +h2, +h3, +h4, +h5, +h6 { + color: white !important; + border-bottom: none !important; +} + +a, +a:visited { + color: white !important; +} + +a:not(:has(>img)):hover, +a:not(:has(>img)):visited:hover { + background-color: transparent !important; + color: white !important; + text-decoration: underline solid white 1px !important; +} + +pre code { + background-color: var(--background-2) !important; + color: white !important; + border-color: white !important; +} + +.language-md, +.token { + color: white !important; +} + +.icon-link>img.invert { + filter: hue-rotate(180deg) invert() !important; +} \ No newline at end of file