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

@ -5,6 +5,7 @@ import ArrowLink from "../../components/ArrowLink.tsx";
import { orgLogo } from "../../lib/media.ts";
import { initialsFor, orgPath } from "../../lib/organizations.ts";
import { AREAS, AREA_NAMES } from "../../data/mapGrid.ts";
import { withAlpha, accentText, readableOn } from '../../lib/color.ts'
/* ═══════════════════════════════════════════════════════════════
ORGANIZATION LIST: MAP
@ -40,9 +41,9 @@ const ROWS = 7;
// stays at max-w-6xl, so this deliberately breaks out past it.
const CONTENT_MAX = "88rem";
const MUTED = "#7a9299";
const RULE = "#cfe3e7";
const INK = "#2c4a50";
const MUTED = "var(--color-muted)";
const RULE = "color-mix(in srgb, var(--color-muted) 25%, transparent)";
const INK = "var(--color-body)";
const FALLBACK_COLOR = "#4a6b72";
/* organizations.color is nullable; an SVG fill left undefined paints
@ -214,7 +215,7 @@ function Tile({
height={size}
rx={14}
fill="none"
stroke={active ? colorOf(primary) : "#ffffff"}
stroke={active ? colorOf(primary) : "var(--color-surface)"}
strokeOpacity={active ? 1 : 0.55}
strokeWidth={active ? 4 : 2}
className="transition-all duration-200"
@ -227,7 +228,7 @@ function Tile({
dominantBaseline="middle"
fontSize={fontSize}
fontWeight="800"
fill={count ? "#ffffff" : colorOf(primary)}
fill={count ? "var(--color-surface)" : colorOf(primary)}
style={{ pointerEvents: "none" }}
>
{label || code}
@ -292,7 +293,7 @@ function LegendButton({ region, selected, setSelected, hovered, setHovered }) {
style={{
border: `1px solid ${colorOf(region)}`,
background: on ? colorOf(region) : "transparent",
color: on ? "#ffffff" : INK,
color: on ? readableOn(colorOf(region)) : INK,
opacity: selected && selected !== region.id ? 0.45 : 1,
}}
>
@ -496,7 +497,7 @@ function ChapterCard({ chapter, color, open, onOpen }) {
className="rounded-2xl p-4 flex items-start gap-4 transition-all duration-200"
style={{
border: `1px solid ${color}`,
background: open ? `${color}14` : "transparent",
background: open ? `${withAlpha(color, 8)}` : "transparent",
}}
>
<OrgLogo org={chapter} color={color} />
@ -574,7 +575,7 @@ function ChapterDetail({ chapter, region, onClose }) {
return (
<div
className="rounded-2xl p-6 mb-6"
style={{ border: `2px solid ${colorOf(region)}`, background: `${colorOf(region)}0f` }}
style={{ border: `2px solid ${colorOf(region)}`, background: `${withAlpha(colorOf(region), 6)}` }}
>
<div className="flex items-start gap-4">
<OrgLogo org={chapter} color={colorOf(region)} size="h-20 w-20" />
@ -616,7 +617,7 @@ function ChapterDetail({ chapter, region, onClose }) {
<Link
to={orgPath(chapter)!}
className="py-2 px-5 rounded-xl font-bold text-sm transition-transform duration-200 hover:scale-105"
style={{ background: colorOf(region), color: "#ffffff" }}
style={{ background: colorOf(region), color: readableOn(colorOf(region)) }}
>
Chapter page
</Link>
@ -723,7 +724,7 @@ function ChapterGrid({ regions, chapters, chaptersIn, subtextFor, openId, setOpe
export function OrgMapToggle({ view, setView, accent }) {
const btn = active => ({
background: active ? accent : "transparent",
color: active ? "#ffffff" : accent,
color: active ? readableOn(accent) : accentText(accent),
});
return (
@ -834,7 +835,7 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
if (error && regions.length === 0) {
return shell(
<p className="font-semibold" style={{ color: accent }}>
<p className="font-semibold" style={{ color: accentText(accent) }}>
· Chapters couldn't be loaded just now, please try again shortly ·
</p>
);