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}`}
>
-
+
{decadeLabel(decade.decade)}
@@ -63,3 +64,11 @@ export default function TimelineDecade({
)
}
+
+/* A decade's tag takes its leaves' color, the middle of the decade
+ (or this year, for the one still running), with text that reads
+ on it. */
+function decadeColors(decade: number) {
+ const background = leafColor(Math.min(decade + 5, new Date().getFullYear()))
+ return { background, color: readableOn(background) }
+}
diff --git a/src/pages/sections/history/timeline.css b/src/pages/sections/history/timeline.css
index 5ba8c2a..09ea13f 100644
--- a/src/pages/sections/history/timeline.css
+++ b/src/pages/sections/history/timeline.css
@@ -18,17 +18,33 @@
--tl-accent: var(--color-link);
--tl-accent-soft: color-mix(in srgb, var(--tl-accent) 12%, transparent);
+ /* The rail is a branch: wood brown, the leaves on it. The one other
+ color outside the palette, with the autumn leaves. */
+ --tl-wood: #7a5236;
+
--tl-gutter: 5rem;
--tl-rail-x: 1.75rem;
- --tl-rail-w: 2px;
+ --tl-rail-w: 3px;
+ --tl-branch: 0.75rem;
color: var(--tl-ink);
}
+/* Lighter wood on a dark page. */
+:root[data-theme="dark"] .site-tl {
+ --tl-wood: #a8805a;
+}
+@media (prefers-color-scheme: dark) {
+ :root:not([data-theme="light"]) .site-tl {
+ --tl-wood: #a8805a;
+ }
+}
+
@media (max-width: 640px) {
.site-tl {
--tl-gutter: 3rem;
--tl-rail-x: 1rem;
+ --tl-branch: 0.4rem;
}
}
@@ -47,13 +63,13 @@
bottom: 0;
left: var(--tl-rail-x);
width: var(--tl-rail-w);
- background: var(--tl-rail);
+ background: var(--tl-wood);
}
.site-tl__decade--pre::before {
background: none;
- border-left: var(--tl-rail-w) solid var(--tl-rail);
- opacity: 0.35;
+ border-left: var(--tl-rail-w) solid var(--tl-wood);
+ opacity: 0.45;
}
/* Last decade fades out rather than stopping dead. */
@@ -80,20 +96,16 @@
padding-block-start: 0.5rem;
}
-/* The numeral is a tag on the rail: a dark block with white type,
- centered on the line, so the rail runs into it and out again.
- (It used to paint the page's color to hide the rail behind it,
- which showed as a white box once sections went transparent.) */
+/* The numeral is a tag off the rail, like a branch: a short slanted
+ stroke of the rail's wood runs up from the line to it, and the line
+ carries on past. Its color is the decade's leaves', set inline
+ (TimelineDecade.tsx). */
.site-tl__decadeNum {
position: relative;
- z-index: 1;
justify-self: start;
width: fit-content;
- margin-left: calc(var(--tl-rail-x) + (var(--tl-rail-w) / 2));
- transform: translateX(-50%);
+ margin-left: calc(var(--tl-rail-x) + var(--tl-rail-w) + var(--tl-branch));
padding: 0.5rem 0.3rem;
- background: var(--color-action);
- color: #ffffff;
font-family: var(--font-display);
font-size: 0.9375rem;
font-weight: 700;
@@ -104,9 +116,16 @@
text-orientation: sideways;
}
-.site-tl__decade--pre .site-tl__decadeNum {
- background: var(--color-tint);
- color: var(--color-muted);
+.site-tl__decadeNum::before {
+ content: '';
+ position: absolute;
+ top: 55%;
+ right: 100%;
+ width: calc(var(--tl-branch) + 0.2rem);
+ height: 3px;
+ background: var(--tl-wood);
+ transform-origin: right center;
+ transform: rotate(28deg);
}
.site-tl__decadeTitle {
@@ -356,9 +375,6 @@ a.site-tl__entry:hover .site-tl__entryTitle {
background: var(--tl-accent);
}
-.site-tl__kind--event {
-}
-
.site-tl__kind--award {
clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
@@ -378,11 +394,14 @@ a.site-tl__entry:hover .site-tl__entryTitle {
margin-bottom: 0.5rem;
}
+/* Solid, not a see-through tint: dark text on a tint on the
+ page's colored backdrop was hard to read. */
.site-tl__entry--featured {
grid-template-columns: minmax(0, 1fr);
padding: 1rem 1.125rem;
border-left: 2px solid var(--tl-accent);
- background: var(--tl-accent-soft);
+ background: color-mix(in srgb, var(--tl-accent) 8%, var(--color-raised));
+ box-shadow: var(--shadow-sm);
}
.site-tl__entry--featured .site-tl__entryTitle {
@@ -397,7 +416,7 @@ a.site-tl__entry:hover .site-tl__entryTitle {
}
a.site-tl__entry--featured:hover {
- background: color-mix(in srgb, var(--tl-accent) 18%, transparent);
+ background: color-mix(in srgb, var(--tl-accent) 16%, var(--color-raised));
}
/* --- Empty state ----------------------------------------------- */
@@ -484,8 +503,8 @@ a.site-tl__entry--featured:hover {
top: 1.25rem;
bottom: 0;
left: var(--tl-rail-x);
- border-left: var(--tl-rail-w) solid var(--tl-rail);
- opacity: 0.35;
+ border-left: var(--tl-rail-w) solid var(--tl-wood);
+ opacity: 0.45;
}
.site-tl__upcomingBtn {
@@ -519,7 +538,7 @@ a.site-tl__entry--featured:hover {
place-items: center;
margin-left: calc(var(--tl-rail-x) - 7px + (var(--tl-rail-w) / 2));
font-size: 14px;
- color: color-mix(in oklch, #00b83d 60%, #00521b);
+ color: #008f2f; /* the leaves' green (leafColor) */
}
.site-tl__upcomingLabel {
@@ -585,7 +604,7 @@ a.site-tl__entry--featured:hover {
.site-tl__roster--featured {
padding: 0.5rem 1.125rem 1rem;
border-left: 2px solid var(--tl-accent);
- background: var(--tl-accent-soft);
+ background: color-mix(in srgb, var(--tl-accent) 8%, var(--color-raised));
margin-top: -0.5rem;
}
@@ -614,7 +633,6 @@ a.site-tl__entry--featured:hover {
.site-tl__personPhoto {
width: 1.75rem;
height: 1.75rem;
- border-radius: 50%;
object-fit: cover;
background: var(--tl-accent-soft);
flex: none;