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

@ -38,8 +38,9 @@ import type { ContentBlock } from '../lib/useContent.ts'
import { Anchor, Inline, Paragraphs } from './InlineText.tsx'
import VideoPlayer from './VideoPlayer.tsx'
import ScheduleBlock from './ScheduleBlock.tsx'
import { accentText } from '../lib/color.ts'
const BODY = '#4a6b72'
const BODY = 'var(--color-muted)'
export default function ContentBlocks({
blocks,
@ -76,14 +77,14 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
switch (block.type) {
case 'heading':
return (
<h3 className="text-2xl font-bold" style={{ color: accent }}>
<h3 className="text-2xl font-bold" style={{ color: accentText(accent) }}>
{text}
</h3>
)
case 'subheading':
return (
<h4 className="text-lg font-semibold" style={{ color: accent }}>
<h4 className="text-lg font-semibold" style={{ color: accentText(accent) }}>
{text}
</h4>
)
@ -93,12 +94,12 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
<ul className="space-y-2">
{(block.items ?? []).map((item, index) => (
<li key={index} className="flex gap-3">
<span aria-hidden="true" style={{ color: accent }}>
<span aria-hidden="true" style={{ color: accentText(accent) }}>
•
</span>
<span style={{ color: BODY }}>
{item.url ? (
<Anchor href={item.url} className="underline" style={{ color: accent }}>
<Anchor href={item.url} className="underline" style={{ color: accentText(accent) }}>
{item.text}
</Anchor>
) : (
@ -120,8 +121,8 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
<Anchor
key={index}
href={item.url as string}
className="rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-[#eef9fb]"
style={{ borderColor: accent, color: accent }}
className="rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-tint"
style={{ borderColor: accent, color: accentText(accent) }}
>
{item.text}
</Anchor>
@ -150,7 +151,7 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
<Inline text={text} accent={accent} />
</blockquote>
{block.cite && (
<figcaption className="mt-2 text-sm font-semibold not-italic" style={{ color: accent }}>
<figcaption className="mt-2 text-sm font-semibold not-italic" style={{ color: accentText(accent) }}>
{block.cite}
</figcaption>
)}
@ -162,7 +163,7 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
return (
<aside
className="space-y-3 rounded-2xl border-l-4 px-6 py-5 leading-relaxed"
style={{ borderColor: accent, background: `color-mix(in srgb, ${accent} 8%, white)`, color: '#26454c' }}
style={{ borderColor: accent, background: `color-mix(in srgb, ${accent} 8%, var(--color-surface))`, color: 'var(--color-body)' }}
>
<Paragraphs text={text} accent={accent} />
</aside>
@ -213,7 +214,7 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
if (!text) return null
return block.href ? (
<p className="leading-relaxed" style={{ color: BODY }}>
<Anchor href={block.href} className="underline" style={{ color: accent }}>
<Anchor href={block.href} className="underline" style={{ color: accentText(accent) }}>
{text}
</Anchor>
</p>