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 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-30 16:26:38 -05:00
parent a397f3eac0
commit e5c14dffa3
5 changed files with 82 additions and 43 deletions

View file

@ -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)
}