From cfcd0c114084cbfcb38ba5647bf23545bbc8763d Mon Sep 17 00:00:00 2001 From: Ari Date: Thu, 15 May 2025 00:58:47 -0400 Subject: [PATCH] Caramelldansen positive fusion achieved --- config.ts | 6 ++++++ src/App.svelte | 32 +++++++++++++++++++++++++++++--- src/app.css | 11 ----------- src/lib/colorgenerator.ts | 26 ++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 src/lib/colorgenerator.ts diff --git a/config.ts b/config.ts index 8d09cf6..5f0ee66 100644 --- a/config.ts +++ b/config.ts @@ -8,6 +8,12 @@ export class Config { */ static readonly PDS_URL: string = "https://pds.witchcraft.systems"; + /** + * Hue value for the color scheme + * @default 257 + */ + static readonly HUE: number = 13; + /** * The base URL of the frontend service for linking to replies/quotes/accounts etc. * @default "https://deer.social" diff --git a/src/App.svelte b/src/App.svelte index c6e7534..5dfdef8 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -4,11 +4,28 @@ import InfiniteLoading from "svelte-infinite-loading"; import { getNextPosts, Post, getAllMetadataFromPds } from "./lib/pdsfetch"; import { Config } from "../config"; - const accountsPromise = getAllMetadataFromPds(); import { onMount } from "svelte"; + import { CssVarsFromHue } from "./lib/colorgenerator"; + + + const accountsPromise = getAllMetadataFromPds(); + let colors = CssVarsFromHue(Config.HUE); let posts: Post[] = []; + const cycleColors = async () => { + let hue = Config.HUE; + while (true) { + colors = CssVarsFromHue(hue); + hue += 1; + if (hue > 360) { + hue = 0; + } + // Wait for 1 second before changing colors again + await new Promise((resolve) => setTimeout(resolve, 10)); + } + } + cycleColors(); onMount(() => { // Fetch initial posts getNextPosts().then((initialPosts) => { @@ -33,7 +50,17 @@ }; -
+
{#await accountsPromise}

Loading...

@@ -65,7 +92,6 @@