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

@ -28,6 +28,7 @@ import { AdminWidthContext } from "../../lib/adminWidth.tsx";
import { SITE_VERSION } from "../../lib/version.ts";
import { ROLE_LABELS, isSuper } from "../../lib/roles.ts";
import nguLogo from "../../assets/logos/NGU_Logo.svg";
import ThemeToggle from "../../components/ThemeToggle.tsx";
import {
ADMIN_HOME,
AREA_TITLES,
@ -45,8 +46,8 @@ import {
function GroupMenu({ item, lit, pathname }) {
const children = item.children ?? [];
const link = lit
? "font-semibold text-[#0f7183]"
: "text-[#4a6b72] transition-colors hover:text-[#0f7183]";
? "font-semibold text-link"
: "text-muted transition-colors hover:text-link";
return (
<div className="group relative">
@ -61,15 +62,15 @@ function GroupMenu({ item, lit, pathname }) {
{children.length > 1 && (
<div className="invisible absolute left-0 top-full z-30 pt-2 opacity-0 transition-opacity group-focus-within:visible group-focus-within:opacity-100 group-hover:visible group-hover:opacity-100">
<ul className="min-w-52 rounded-xl border border-[#138ba0]/20 bg-white p-1.5 shadow-lg">
<ul className="min-w-52 rounded-xl border border-brand/20 bg-surface p-1.5 shadow-lg">
{children.map((child) => (
<li key={child.to}>
<NavLink
to={child.to}
className={`block rounded-lg px-3 py-2 text-sm transition-colors hover:bg-[#eef9fb] ${
className={`block rounded-lg px-3 py-2 text-sm transition-colors hover:bg-tint ${
matches(pathname, child.to)
? "font-semibold text-[#0f7183]"
: "text-[#26454c]"
? "font-semibold text-link"
: "text-body"
}`}
>
{child.label}
@ -130,11 +131,11 @@ export default function AdminLayout() {
const subnav = active?.children ?? [];
const wordmark = <span className="text-lg font-bold text-[#0f7183]">{areaTitle}</span>;
const wordmark = <span className="text-lg font-bold text-link">{areaTitle}</span>;
return (
<div className="flex min-h-screen flex-col bg-[#f6fbfc]">
<header className="border-b border-[#138ba0]/20 bg-white">
<div className="flex min-h-screen flex-col bg-tint-soft">
<header className="border-b border-brand/20 bg-surface">
<div className="mx-auto flex max-w-5xl flex-wrap items-center gap-x-8 gap-y-3 px-6 py-4">
{/* Already home, so nothing to link to. */}
{isHome ? (
@ -156,7 +157,7 @@ export default function AdminLayout() {
{item.separated && (
<span
aria-hidden="true"
className="h-4 w-px bg-[#4a6b72]/25"
className="h-4 w-px bg-muted/25"
/>
)}
<GroupMenu item={item} lit={item === active} pathname={pathname} />
@ -165,14 +166,15 @@ export default function AdminLayout() {
</nav>
)}
<div className="ml-auto flex items-center gap-4 text-sm text-[#4a6b72]">
<div className="ml-auto flex items-center gap-4 text-sm text-muted">
<ThemeToggle className="hover:bg-tint hover:text-link" />
<span>
{user?.name || user?.email}
</span>
<button
type="button"
onClick={handleLogout}
className="rounded-full border border-[#4a6b72]/30 px-4 py-1.5 font-medium transition-colors hover:bg-[#eef9fb] hover:text-[#0f7183]"
className="rounded-full border border-muted/30 px-4 py-1.5 font-medium transition-colors hover:bg-tint hover:text-link"
>
Sign out
</button>
@ -182,7 +184,7 @@ export default function AdminLayout() {
{/* Subnav. Only drawn where there is something to draw, so
Events and People don't get an empty grey strip. */}
{subnav.length > 0 && (
<div className="border-t border-[#138ba0]/10 bg-[#f6fbfc]">
<div className="border-t border-brand/10 bg-tint-soft">
<div className="mx-auto flex max-w-5xl flex-wrap gap-6 px-6 py-2.5 text-sm">
{subnav.map((child) => (
<NavLink
@ -190,8 +192,8 @@ export default function AdminLayout() {
to={child.to}
className={
child === activeChild
? "font-semibold text-[#0f7183]"
: "text-[#4a6b72] transition-colors hover:text-[#0f7183]"
? "font-semibold text-link"
: "text-muted transition-colors hover:text-link"
}
>
{child.label}
@ -213,12 +215,12 @@ export default function AdminLayout() {
</AdminTitleContext.Provider>
</main>
<footer className="border-t border-[#138ba0]/15 bg-white">
<footer className="border-t border-brand/15 bg-surface">
<div className="mx-auto flex max-w-5xl items-center gap-4 px-6 py-3">
<Link to={ADMIN_HOME} className="transition-opacity hover:opacity-70">
<img src={nguLogo} alt="NGU" className="h-6 w-auto" />
</Link>
<span className="ml-auto font-mono text-xs text-[#4a6b72]/70">
<span className="ml-auto font-mono text-xs text-muted/70">
{SITE_VERSION}
</span>
</div>