Add colour tokens, dark mode and drop gradients

- Colour tokens in index.css named by role (ink, body, muted, link,
  brand, action, surface, tint, danger), used everywhere instead of hex
- Dark mode: follows the system, a header toggle (site and admin)
  overrides it and is remembered; set before first paint in index.html
- Data colours go through src/lib/color.ts: withAlpha for tints,
  accentText (lighter on dark) for text in an accent, readableOn for
  text on one, so an admin's pale colour still reads
- Migration 040 drops events.gradient: a card is its photo or plain,
  with its colour as the border; other decorative gradients are solid
- The countdown and a hero event without a photo mix their colour
  toward ink behind white text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-28 22:42:59 -05:00
parent ee61568911
commit c74ad746f5
70 changed files with 829 additions and 596 deletions

View file

@ -6,6 +6,7 @@ import { EVENT_TYPES, eventTypeLabel } from "../../lib/eventTypes.ts";
import { seriesLabel } from "../../lib/eventSeries.ts";
import PlatformIcon from "../../components/PlatformIcon.tsx";
import { eventBackground, eventLogo as eventLogoSrc, orgLogo as orgLogoSrc } from "../../lib/media.ts";
import { accentText, withAlpha, readableOn } from '../../lib/color.ts'
/* ═══════════════════════════════════════════════════════════════
EVENT LIST: CARDS
@ -50,20 +51,19 @@ function Logo({ src, alt = "", className }) {
}
const TEAL = "#0f7183"; // last-resort card color
const INK = "#073d4a"; // button text: the card colour is only a border
const CARD_BG = "#ffffff"; // sits under every card, gradient or not
const INK = "var(--color-ink)"; // button text: the card colour is only a border
const CARD_BG = "var(--color-surface)"; // sits under every card, photo or not
/* Laid over a card's background image so black text reads on any
photo. Heavier at the top, where the title and dates are, and
lighter lower down so more of the picture shows through. */
const CARD_IMAGE_VEIL =
"linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,255,255,0.78))";
"linear-gradient(to bottom, color-mix(in srgb, var(--color-surface) 90%, transparent), color-mix(in srgb, var(--color-surface) 78%, transparent))";
/* The card's background layers, top first: its gradient if it has
one, then the veil and photo if it has one, then white. */
/* The card's background layers, top first: the veil and photo if it
has one, then the plain surface. */
function cardBackground(ev) {
const layers: string[] = [];
if (ev.gradient) layers.push(ev.gradient);
const image = eventBackground(ev.card_image);
if (image) {
layers.push(CARD_IMAGE_VEIL, `url(${JSON.stringify(image)}) center / cover no-repeat`);
@ -192,7 +192,7 @@ export function Card({
return (
<div
className={`rounded-3xl text-black overflow-hidden shadow-2xl h-full flex flex-col ${
className={`rounded-3xl text-ink overflow-hidden shadow-2xl h-full flex flex-col ${
compact ? "ev-card" : ""
}`}
style={{
@ -278,7 +278,7 @@ export function Card({
doesn't. */}
<div className={`mt-auto ${compact ? "pt-6" : "pt-8"}`}>
{links.length === 0 && (
<p className="text-center font-semibold" style={{ color: accent }}>
<p className="text-center font-semibold" style={{ color: accentText(accent) }}>
{past
? "This event has concluded. Thank you to everyone who joined us!"
: igHandle
@ -320,7 +320,7 @@ export function Card({
className={`ig-link flex items-center justify-center rounded-xl font-bold transition-all duration-200 hover:scale-[1.02] gap-3 ${
compact ? "py-2.5 px-5" : "py-3 px-6"
}`}
style={{ border: `1px solid ${accent}`, color: accent }}
style={{ border: `1px solid ${accent}`, color: accentText(accent) }}
>
<PlatformIcon platform="instagram" className="w-6 h-6" />
{igHandle}
@ -362,7 +362,7 @@ export function TypeFilter({ types, active, setActive, accent }) {
const chip = on => ({
border: `1px solid ${accent}`,
background: on ? accent : "transparent",
color: on ? "#ffffff" : accent,
color: on ? readableOn(accent) : accentText(accent),
});
const button = (id, label) => (
@ -396,7 +396,7 @@ export function TypeFilter({ types, active, setActive, accent }) {
export function EventCardsToggle({ view, setView, accent }) {
const btn = active => ({
background: active ? accent : "transparent",
color: active ? "#ffffff" : accent,
color: active ? readableOn(accent) : accentText(accent),
});
return (
@ -522,14 +522,14 @@ export default function EventListCards({
// Arrows and dots follow the section accent, not the active card.
const arrowStyle = enabled => ({
border: `1px solid ${accent}`,
background: "rgba(255,255,255,0.85)",
color: enabled ? accent : "#b8c6c9",
background: "color-mix(in srgb, var(--color-surface) 85%, transparent)",
color: enabled ? accentText(accent) : withAlpha("var(--color-muted)", 50),
cursor: enabled ? "pointer" : "default",
opacity: enabled ? 1 : 0.4,
});
const notice = text => (
<p className="max-w-6xl mx-auto px-6 font-semibold" style={{ color: accent }}>
<p className="max-w-6xl mx-auto px-6 font-semibold" style={{ color: accentText(accent) }}>
{text}
</p>
);
@ -600,7 +600,7 @@ export default function EventListCards({
<div className="mt-12">
<h3
className="text-2xl font-extrabold mb-6"
style={{ color: accent, opacity: 0.85 }}
style={{ color: accentText(accent), opacity: 0.85 }}
>
Past Events
</h3>
@ -640,7 +640,7 @@ export default function EventListCards({
onClick={() => setShowPast(v => !v)}
aria-expanded={showPast}
className="flex items-center gap-2 py-2.5 px-6 rounded-xl font-bold transition-all duration-200 hover:scale-105"
style={{ border: `1px solid ${accent}`, color: accent }}
style={{ border: `1px solid ${accent}`, color: accentText(accent) }}
>
{showPast
? "Hide past events"
@ -737,7 +737,7 @@ export default function EventListCards({
className="h-2.5 rounded-full transition-all duration-200"
style={{
width: i === index ? "1.5rem" : "0.625rem",
background: i === index ? accent : "#b8c6c9",
background: i === index ? accent : withAlpha("var(--color-muted)", 40),
}}
/>
))}