Tint donate UI accent to match the glow colour

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
anonymousratwastaken 2026-10-24 13:32:13 +01:00
parent 32200dbeca
commit 5a34a2471f
2 changed files with 27 additions and 3 deletions

View file

@ -16,7 +16,7 @@ import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { TIERS, tierForAmount, upgradePrice } from "@/lib/donations";
import { TopBar } from "@/components/top-bar";
import { DonateGlow, type GlowTheme } from "@/components/donate-glow";
import { DonateGlow, glowAccentStyle, type GlowTheme } from "@/components/donate-glow";
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY ?? "");
@ -604,7 +604,7 @@ function DonateFlow() {
if (!started) {
return (
<main className="relative z-0 min-h-dvh bg-background text-foreground font-mona flex flex-col">
<main style={glowAccentStyle(glow)} className="relative z-0 min-h-dvh bg-background text-foreground font-mona flex flex-col">
<DonateGlow theme={glow} />
<TopBar />
<div className="flex-1 flex items-center justify-center px-4 py-12">
@ -620,7 +620,7 @@ function DonateFlow() {
}
return (
<main className="relative z-0 min-h-dvh bg-background text-foreground font-mona flex flex-col">
<main style={glowAccentStyle(glow)} className="relative z-0 min-h-dvh bg-background text-foreground font-mona flex flex-col">
<DonateGlow theme={glow} />
<TopBar />
<div className="flex-1 flex items-center justify-center px-4 py-8">

View file

@ -30,6 +30,30 @@ export const GLOW_THEMES = {
export type GlowTheme = keyof typeof GLOW_THEMES;
// UI accent that goes with each glow. `green` is the site default, so it sets
// nothing and the stylesheet's own --primary applies.
const GLOW_ACCENTS: Record<GlowTheme, { primary: string; foreground: string } | null> = {
green: null,
lime: { primary: "#a6ff3c", foreground: "#14210a" },
teal: { primary: "#2dd4bf", foreground: "#042f2b" },
purple: { primary: "#8b6cf6", foreground: "#ffffff" },
blue: { primary: "#4a90f7", foreground: "#ffffff" },
iron: { primary: "#cbd5e1", foreground: "#1e293b" },
gold: { primary: "#fbbf24", foreground: "#2b1d02" },
diamond: { primary: "#22d3ee", foreground: "#052e38" },
};
// Inline style that retints the accent variables for the glow's theme.
export function glowAccentStyle(theme: GlowTheme): React.CSSProperties | undefined {
const accent = GLOW_ACCENTS[theme];
if (!accent) return undefined;
return {
"--primary": accent.primary,
"--primary-foreground": accent.foreground,
"--ring": accent.primary,
} as React.CSSProperties;
}
const VERTEX_SHADER = `#version 300 es
in vec2 position;
void main() {