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 @@