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

@ -49,8 +49,8 @@ export type MediaItem = {
};
const button =
"rounded-full border border-[#138ba0] px-3 py-1 text-sm font-medium text-[#0f7183] " +
"transition-colors hover:bg-[#eef9fb] disabled:cursor-default disabled:opacity-50";
"rounded-full border border-brand px-3 py-1 text-sm font-medium text-link " +
"transition-colors hover:bg-tint disabled:cursor-default disabled:opacity-50";
/* A light checkerboard, so a white logo on a transparent background
is still visible in its thumbnail. */
@ -166,18 +166,18 @@ export function UploadButton({
className="hidden"
onChange={(e) => send(e.target.files)}
/>
<label htmlFor={keepId} className="flex items-center gap-1.5 text-xs text-[#4a6b72]">
<label htmlFor={keepId} className="flex items-center gap-1.5 text-xs text-muted">
<input
id={keepId}
type="checkbox"
checked={keepOriginal}
onChange={(e) => setKeepOriginal(e.target.checked)}
className="h-3.5 w-3.5 rounded border-[#4a6b72]/40 text-[#0f7183]"
className="h-3.5 w-3.5 rounded border-muted/40 text-link"
/>
Keep original
</label>
</div>
{error && <p className="mt-1 text-xs text-[#b3261e]">{error}</p>}
{error && <p className="mt-1 text-xs text-danger">{error}</p>}
</div>
);
}
@ -200,7 +200,7 @@ export function MediaGrid({
renderActions?: (item: MediaItem) => ReactNode;
}) {
if (items.length === 0) {
return <p className="text-sm text-[#4a6b72]">Nothing here yet.</p>;
return <p className="text-sm text-muted">Nothing here yet.</p>;
}
return (
@ -214,7 +214,7 @@ export function MediaGrid({
// A still of the first frame; metadata only, not the file.
<video src={item.url} preload="metadata" muted className="h-full w-full bg-black object-contain" />
) : item.content_type.startsWith("audio/") ? (
<div className="flex h-full w-full items-center justify-center bg-[#eef9fb] text-3xl" aria-hidden="true">
<div className="flex h-full w-full items-center justify-center bg-tint text-3xl" aria-hidden="true">
♪
</div>
) : (
@ -226,18 +226,18 @@ export function MediaGrid({
/>
)}
</div>
<p className="mt-1.5 truncate text-xs font-medium text-[#26454c]" title={item.original_name}>
<p className="mt-1.5 truncate text-xs font-medium text-body" title={item.original_name}>
{item.original_name}
</p>
<p className="text-xs text-[#4a6b72]/80">{mediaSize(item)}</p>
<p className="text-xs text-muted/80">{mediaSize(item)}</p>
</>
);
return (
<li
key={item.id}
className={`rounded-xl border bg-white p-2 ${
isSelected ? "border-[#138ba0] ring-2 ring-[#138ba0]/30" : "border-[#4a6b72]/20"
className={`rounded-xl border bg-surface p-2 ${
isSelected ? "border-brand ring-2 ring-brand/30" : "border-muted/20"
}`}
>
{onPick ? (
@ -292,27 +292,27 @@ export function MediaPicker({
className="w-[min(56rem,calc(100vw-2rem))] rounded-2xl p-0 backdrop:bg-[#0f2f36]/40"
>
<div className="flex max-h-[85vh] flex-col">
<div className="flex flex-wrap items-center gap-3 border-b border-[#138ba0]/15 px-5 py-4">
<h2 className="text-lg font-semibold text-[#0f7183]">Choose an image</h2>
<div className="flex flex-wrap items-center gap-3 border-b border-brand/15 px-5 py-4">
<h2 className="text-lg font-semibold text-link">Choose an image</h2>
<input
type="search"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder="Search by file name"
className="ml-auto w-56 rounded-lg border border-[#4a6b72]/25 px-3 py-1.5 text-sm outline-none focus:border-[#138ba0]"
className="ml-auto w-56 rounded-lg border border-muted/25 px-3 py-1.5 text-sm outline-none focus:border-brand"
/>
<button
type="button"
onClick={() => dialogRef.current?.close()}
aria-label="Close"
className="h-8 w-8 rounded-full text-[#4a6b72] hover:bg-[#eef9fb]"
className="h-8 w-8 rounded-full text-muted hover:bg-tint"
>
✕
</button>
</div>
{roleCanWrite(user) && (
<div className="border-b border-[#138ba0]/10 px-5 py-3">
<div className="border-b border-brand/10 px-5 py-3">
<UploadButton
label="Upload new"
onUploaded={(item) => {
@ -321,15 +321,15 @@ export function MediaPicker({
dialogRef.current?.close();
}}
/>
<p className="mt-1 text-xs text-[#4a6b72]">{UPLOAD_HELP}</p>
<p className="mt-1 text-xs text-muted">{UPLOAD_HELP}</p>
</div>
)}
<div className="overflow-y-auto px-5 py-4">
{error ? (
<p className="text-sm text-[#b3261e]">{error}</p>
<p className="text-sm text-danger">{error}</p>
) : items === null ? (
<p className="text-sm text-[#4a6b72]">Loading…</p>
<p className="text-sm text-muted">Loading…</p>
) : (
<MediaGrid
items={items}
@ -375,13 +375,13 @@ export function ImageInput({
return (
<div className="flex gap-3">
<div
className="flex h-20 w-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[#4a6b72]/20"
className="flex h-20 w-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-muted/20"
style={CHECKER}
>
{src && !broken ? (
<img src={src} alt="" className="h-full w-full object-contain" onError={() => setBroken(true)} />
) : (
<span className="px-1 text-center text-[10px] text-[#4a6b72]/70">
<span className="px-1 text-center text-[10px] text-muted/70">
{src ? "Not found" : "No image"}
</span>
)}
@ -406,7 +406,7 @@ export function ImageInput({
<button
type="button"
onClick={() => onChange("")}
className="px-2 py-1 text-sm text-[#4a6b72] hover:text-[#b3261e]"
className="px-2 py-1 text-sm text-muted hover:text-danger"
>
Clear
</button>
@ -498,7 +498,7 @@ export function LinkPreviewInput({
{busy ? "Fetching…" : "Fetch preview"}
</button>
{note && (
<span className={`text-xs ${note.tone === "ok" ? "text-[#0f7183]" : "text-[#b3261e]"}`}>
<span className={`text-xs ${note.tone === "ok" ? "text-link" : "text-danger"}`}>
{note.text}
</span>
)}