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

@ -27,8 +27,9 @@ import { personHref } from '../lib/hrefs.ts'
import { blockMedia, initials, personPhoto } from '../lib/media.ts'
import type { ContentBlockItem } from '../lib/useContent.ts'
import { Anchor, Paragraphs } from './InlineText.tsx'
import { withAlpha, accentText, readableOn } from '../lib/color.ts'
const BODY = '#4a6b72'
const BODY = 'var(--color-muted)'
const WEEKDAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']
type Day = { name: string; entries: ContentBlockItem[] }
@ -71,7 +72,7 @@ function Avatar({ person, size }: { person: NonNullable<ContentBlockItem['person
) : (
<span
aria-hidden="true"
className={`${size} flex shrink-0 items-center justify-center rounded-full bg-[#eef9fb] text-xs font-bold text-[#0f7183]`}
className={`${size} flex shrink-0 items-center justify-center rounded-full bg-tint text-xs font-bold text-link`}
>
{initials(person.name)}
</span>
@ -88,7 +89,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
const more = Boolean(entry.description || graphic || place || entry.person)
const title = entry.url ? (
<Anchor href={entry.url} className="underline-offset-2 hover:underline" style={{ color: accent }}>
<Anchor href={entry.url} className="underline-offset-2 hover:underline" style={{ color: accentText(accent) }}>
{entry.text}
</Anchor>
) : (
@ -96,14 +97,14 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
)
return (
<li className="border-b border-[#138ba0]/10 last:border-b-0">
<li className="border-b border-brand/10 last:border-b-0">
<div className="flex gap-4 py-4 sm:gap-6">
<p className="w-24 shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accent }}>
<p className="w-24 shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accentText(accent) }}>
{entry.time}
</p>
<div className="min-w-0 flex-1">
<p className="font-semibold text-[#26454c]">{title}</p>
<p className="font-semibold text-body">{title}</p>
{(entry.location || entry.person) && (
<p className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm" style={{ color: BODY }}>
{entry.location && <span>{entry.location}</span>}
@ -129,8 +130,8 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
aria-expanded={open}
aria-controls={panelId}
aria-label={open ? `Less about ${entry.text}` : `More about ${entry.text}`}
className="h-8 w-8 shrink-0 rounded-full border text-sm transition-colors hover:bg-[#eef9fb]"
style={{ borderColor: `${accent}55`, color: accent }}
className="h-8 w-8 shrink-0 rounded-full border text-sm transition-colors hover:bg-tint"
style={{ borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }}
>
<span aria-hidden="true" className={`inline-block transition-transform ${open ? 'rotate-180' : ''}`}>
▾
@ -140,7 +141,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
</div>
{more && open && (
<div id={panelId} className="mb-5 space-y-5 rounded-2xl bg-[#f6fbfc] p-5 sm:ml-38">
<div id={panelId} className="mb-5 space-y-5 rounded-2xl bg-tint-soft p-5 sm:ml-38">
{entry.person && (
<div className="flex items-center gap-4">
<Avatar person={entry.person} size="h-16 w-16" />
@ -148,7 +149,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
<Link
to={personHref(entry.person.id)}
className="font-semibold hover:underline"
style={{ color: accent }}
style={{ color: accentText(accent) }}
>
{entry.person.name}
</Link>
@ -184,7 +185,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
type="button"
onClick={() => setShowMap(true)}
className="flex aspect-video w-full flex-col items-center justify-center gap-1 rounded-lg border border-dashed text-sm"
style={{ borderColor: `${accent}55`, color: BODY }}
style={{ borderColor: `${withAlpha(accent, 33)}`, color: BODY }}
>
<span className="font-semibold">Show map</span>
<span className="text-xs">{place}, from Google Maps</span>
@ -195,7 +196,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
target="_blank"
rel="noreferrer"
className="mt-2 inline-block text-sm underline"
style={{ color: accent }}
style={{ color: accentText(accent) }}
>
Open in Google Maps
</a>
@ -258,8 +259,8 @@ export default function ScheduleBlock({
className="rounded-full border px-5 py-2 text-sm font-semibold transition-colors"
style={
selected
? { background: accent, borderColor: accent, color: '#ffffff' }
: { borderColor: `${accent}55`, color: accent }
? { background: accent, borderColor: accent, color: readableOn(accent) }
: { borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }
}
>
{day.name || 'Schedule'}
@ -273,7 +274,7 @@ export default function ScheduleBlock({
id={`${baseId}-panel`}
role={days.length > 1 ? 'tabpanel' : undefined}
aria-labelledby={days.length > 1 ? `${baseId}-tab-${days.indexOf(current)}` : undefined}
className="rounded-2xl border border-[#138ba0]/15 bg-white px-5"
className="rounded-2xl border border-brand/15 bg-surface px-5"
>
{current.entries.map((entry, index) => (
<Entry key={`${current.name}-${index}`} entry={entry} accent={accent} />