Timeline years as leaves, green now and turning autumn going back; notices instead of dashed boxes
A year's leaf eases from green to gold to autumn between this year and 2000 (leafColor in color.ts); every year before 2000 is fully turned. Empty-section and form notes use one notice style, a flat tinted panel with a solid left bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
592e07f614
commit
d5428297a4
12 changed files with 99 additions and 66 deletions
|
|
@ -88,3 +88,25 @@ export function paletteFill(name: string): { background: string; color: string }
|
|||
for (const char of name.trim().toLowerCase()) hash = (hash * 31 + char.charCodeAt(0)) >>> 0
|
||||
return NAMED_FILLS[hash % NAMED_FILLS.length]
|
||||
}
|
||||
|
||||
/* ── Timeline leaves ─────────────────────────────────────────────
|
||||
Each year on a timeline is a leaf, green for this year and
|
||||
turning autumn as the years go back: gold, then orange, reaching
|
||||
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)'
|
||||
const LEAF_GOLD = '#c98a0b'
|
||||
const LEAF_AUTUMN = '#b8461b'
|
||||
const LEAF_TURNED_BY = 2000
|
||||
|
||||
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})`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue