glytch/fktry/src/ui/palette.ts
type-two e25c854be8 [ui] inspector recipe picker + heat states; fax queue peek and stamps
Inspector: setRecipe finally has a UI — a process picker listing each
machine's recipes as readable lines ("1 LUMA BARS -> 1 COEFFICIENT PACK +
1 HF DUST"). Heat gets a bar with THROTTLING and SCRAM states rather than a
number. Jam reasons route through jamText() so 'starved' and 'output full'
read as different problems, and an unknown reason passes through uppercased
instead of being swallowed.

Fax: NEXT IN TRAY peek, a STANDING ORDER stamp for repeat commissions, and a
SANITISING chip once anchor-slabs ship (hardcoded id sanctioned this round).

voice.ts/palette.ts now prefer MachineDef.flavor/.color from data and keep the
round-1 hand-transcribed tables as fallback. chipspec.ts lifts the chip
arithmetic out of the DOM so it can be tested.

Caveats in NOTES: the sim pins the active commission to commissions[0] and
never advances, so STANDING ORDER is unreachable; NEXT IN TRAY infers "next"
from data order because the snapshot has no queue.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 17:27:45 +10:00

38 lines
1.4 KiB
TypeScript

/**
* LANE-UI — machine accent colors for build-bar icons.
*
* `MachineDef.color` (contracts v2) is the source of truth and wins whenever LANE-DATA
* has filled it — the same value LANE-RENDER tints its placeholder boxes with, so the
* bar and the world agree about what a quantizer looks like.
*
* The tables below are the round-1 stopgap, kept as fallback: transcribed from
* docs/FKTRY_LORE.md §4 (each machine's ASSET block names its impossible element).
* Order: data color, else id override, else kind fallback, else house green. Never
* crashes on a machine we've never heard of.
*/
import type { MachineDef, MachineKind } from '../contracts';
const BY_ID: Record<string, string> = {
'seam-extractor': '#c8a03f', // grimy yellow chassis
belt: '#5a7a5a',
demuxer: '#ff3fd4', // the magenta output chute
quantizer: '#e8e0ff', // HF dust leaking from the seams
'mosh-reactor': '#ff7a3f', // melt, seen through the porthole
'decode-asic': '#3fffe0', // serene LED face
shipper: '#d8ffd8', // THE SCREEN's own light
};
const BY_KIND: Record<MachineKind, string> = {
extractor: '#c8a03f',
belt: '#5a7a5a',
crafter: '#3fffe0',
splitter: '#7fb0ff',
power: '#3fffe0',
buffer: '#7fb0ff',
shipper: '#d8ffd8',
};
export function machineColor(def: MachineDef): string {
return def.color || BY_ID[def.id] || BY_KIND[def.kind] || '#d8ffd8';
}