From e5c14dffa32ebeae18bab999fe3c0ff765e8be33 Mon Sep 17 00:00:00 2001 From: Zaldimmar Date: Wed, 30 Sep 2026 16:26:38 -0500 Subject: [PATCH] Timeline on a brown branch with leaf-colored decade tags; solid featured entries; admin home in two alternating colors Co-Authored-By: Claude Opus 5.5 --- docs/updating-data-in-code.md | 2 +- src/lib/color.ts | 20 ++++-- src/pages/admin/AdminHome.tsx | 22 +++--- src/pages/sections/history/TimelineDecade.tsx | 11 ++- src/pages/sections/history/timeline.css | 70 ++++++++++++------- 5 files changed, 82 insertions(+), 43 deletions(-) diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index c9aca8f..11cbc15 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -277,7 +277,7 @@ The numbers band's "Number Source" dropdown works the same way: | The site's colors, light and dark | the database over `src/index.css` | Admin → Panel → Site settings → Colors (superadmins): pick a color, set its light and/or dark value; saving refuses anything that makes text hard to read. The defaults are `THEME_DEFAULTS` in `server/src/themeDefaults.js` (the admin and the contrast check read it) and the same values as CSS in `src/index.css`; the build stops if the two differ. The admin's labels for them are `THEME_LABELS` in `src/lib/adminSchema/siteSettings.ts`. Change a token's value in both modes and every use follows. Use the token utilities (`text-muted`, `bg-surface`, `border-brand/20`) or `var(--color-…)`, not hex. A color that arrives as data (a page accent, an event's or region's color) goes through `src/lib/color.ts`: `withAlpha` for tints, `accentText` for text in it, `readableOn` for text on it. | | The icons a Front page "Find your way in" path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. | | A page section's accent color | `BRAND` and `ACCENTS` in `src/lib/color.ts` | Pages pick from these (`accent: ACCENTS.green`); add a color there, not a hex in a page. Each is readable as text on white and the tints. | -| The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's circles and tones are in `src/components/PageBackdrop.css`; the admin home's group colors are `GROUPS` in `src/pages/admin/AdminHome.tsx`. | +| The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's circles and tones are in `src/components/PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. | | Timeline leaf colors (green now, autumn going back) | `leafColor` in `src/lib/color.ts` | The green, gold and autumn stops, and `LEAF_TURNED_BY` (2000), the year before which every leaf is fully turned. | | Privacy Policy and Terms wording | `src/pages/Privacy.tsx`, `src/pages/Terms.tsx` | The `PARTS` list, and `LAST_UPDATED` whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. | | Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. | diff --git a/src/lib/color.ts b/src/lib/color.ts index 641682e..85a15c2 100644 --- a/src/lib/color.ts +++ b/src/lib/color.ts @@ -95,18 +95,30 @@ export function paletteFill(name: string): { background: string; color: string } full autumn at 2000; every year before 2000 is fully turned. The green is the palette's, deepened so a leaf stands out on the page; the autumn shades are the one set of colors outside the - palette, since the palette has none. */ -const LEAF_GREEN = 'color-mix(in oklch, #00b83d 60%, #00521b)' + palette, since the palette has none. A hex, so readableOn can + pick text for something filled with it (a decade's tag). */ +const LEAF_GREEN = '#008f2f' // #00b83d deepened toward #00521b const LEAF_GOLD = '#c98a0b' const LEAF_AUTUMN = '#b8461b' const LEAF_TURNED_BY = 2000 +function mixHex(from: string, to: string, amount: number): string { + const channel = (hex: string, i: number) => parseInt(hex.slice(i, i + 2), 16) + return ( + '#' + + [1, 3, 5] + .map((i) => Math.round(channel(from, i) + (channel(to, i) - channel(from, i)) * amount)) + .map((value) => value.toString(16).padStart(2, '0')) + .join('') + ) +} + export function leafColor(year: number, thisYear = new Date().getFullYear()): string { if (year < LEAF_TURNED_BY) return LEAF_AUTUMN const span = Math.max(1, thisYear - LEAF_TURNED_BY) const turned = Math.min(1, Math.max(0, (thisYear - year) / span)) // Green to gold over the first half of the span, gold to autumn over the second. return turned <= 0.5 - ? `color-mix(in oklch, ${LEAF_GOLD} ${Math.round(turned * 200)}%, ${LEAF_GREEN})` - : `color-mix(in oklch, ${LEAF_AUTUMN} ${Math.round((turned - 0.5) * 200)}%, ${LEAF_GOLD})` + ? mixHex(LEAF_GREEN, LEAF_GOLD, turned * 2) + : mixHex(LEAF_GOLD, LEAF_AUTUMN, (turned - 0.5) * 2) } diff --git a/src/pages/admin/AdminHome.tsx b/src/pages/admin/AdminHome.tsx index bf446a6..d1b818b 100644 --- a/src/pages/admin/AdminHome.tsx +++ b/src/pages/admin/AdminHome.tsx @@ -11,9 +11,10 @@ Forms, Tools, and Panel, which only exists for superadmins. It asks for the wide admin column (adminWidth.tsx), like the - editor, so the cards run three across on a wide screen. Each - block takes a color from the palette (GROUPS), tinting its - cards and drawing its bar, so the groups read apart at a glance. + editor, so the cards run three across on a wide screen. The + blocks alternate between two palette colors (BLOCK_COLORS), + tinting their cards and drawing their bars, so neighboring groups + read apart at a glance. The right-hand panel is deliberately inert. Nothing here fetches, so the landing page can't be slow or half-broken on @@ -46,7 +47,7 @@ function NavCard({ item, color }) { return (
@@ -112,13 +113,12 @@ function PanelSection({ title, children }) { /* The header's groups, in its order, each with its palette color. Panel is drawn separately below, since only superadmins get it. */ -const GROUPS = [ - { nav: DATA_NAV, color: PALETTE.teal[0] }, - { nav: PAGES_NAV, color: PALETTE.green[0] }, - { nav: FORMS_NAV, color: PALETTE.mint[2] }, - { nav: TOOLS_NAV, color: PALETTE.ink[2] }, -]; -const PANEL_COLOR = PALETTE.ink[1]; +const BLOCK_COLORS = [PALETTE.teal[0], PALETTE.green[0]]; +const GROUPS = [DATA_NAV, PAGES_NAV, FORMS_NAV, TOOLS_NAV].map((nav, index) => ({ + nav, + color: BLOCK_COLORS[index % BLOCK_COLORS.length], +})); +const PANEL_COLOR = BLOCK_COLORS[GROUPS.length % BLOCK_COLORS.length]; const QUICK_ADD = [ { to: "/admin/events/new", label: "New event" }, diff --git a/src/pages/sections/history/TimelineDecade.tsx b/src/pages/sections/history/TimelineDecade.tsx index 4466ad0..14b7e4e 100644 --- a/src/pages/sections/history/TimelineDecade.tsx +++ b/src/pages/sections/history/TimelineDecade.tsx @@ -6,6 +6,7 @@ import { type SortDirection, } from '../../../lib/timeline.ts' import TimelineYear from './TimelineYear.tsx' +import { leafColor, readableOn } from '../../../lib/color.ts' type Props = { decade: GroupedDecade @@ -31,7 +32,7 @@ export default function TimelineDecade({ aria-labelledby={`site-tl-decade-${decade.decade}`} >
-