engine/retro library

The Retro hardware family's palette builder (spec §5.3 #5; motion brief §2.3 "Retro hardware"; docs/m4-design.md §B): a 90s desk or pocket calculator.

  • Body (the background): beige/cream moulded plastic (a light theme, "desk") or black/charcoal plastic (a dark theme, "pocket"), solid or with a faint top-to-bottom sheen.
  • Keys: muted keycaps — cream or dark-brown digits on a desk body, graphite on a pocket body — function keys a step away, and a single coloured accent (orange, red, green, blue or teal) for = and, in two themes out of three, the operators; otherwise operators are a contrasting neutral. Operators always carry a heavier label weight (recorded as OperatorCue.weight, the non-colour cue).
  • Display: a 7-segment panel (TypeSpec.lcd) whose colour is the palette surface: a grey-green / grey-yellow TN LCD with near-black segments, or (one theme in four) a VFD — dark glass with bright cyan or green segments. displayText is the lit segment colour (≥ 4.5:1 on the panel, 7:1 accessible), Palette.lcdGhost the unlit segments (≈ 1.10–1.20:1, never above 1.3:1).

Every draw comes from the same named sub-streams as the generic pipeline (palette with its retry streams, background, shape, style, type, motion, sound, name), so a Retro theme is a pure function of (seed, engineVersion, accessible). The constants here are part of engine version 2's Retro definition: changing one changes generated themes and needs a version bump.

Enums

RetroPanel
The two display technologies a Retro theme can have.

Constants

retroAccentHues → const List<Weighted<int>>
The accent hues of = (and accent operators), tenths of a degree: orange, red, green, blue, teal — the colours real keypads used. Bile hues (75–115°) are never offered.
retroDeskChromaMilli → const IntRange
Desk body chroma range, thousandths (always below the bile rule's chroma floor, so beige is never "disliked").
retroDeskHueTenths → const IntRange
Desk (beige) body hue range, tenths of a degree (warm cream).
retroLcdChromaMilli → const IntRange
retroLcdGhostRatio → const IntRange
Ghost-segment contrast against the panel × 100, LCD and VFD.
retroLcdHueTenths → const IntRange
retroLcdLMilli → const IntRange
LCD panel: lightness, hue (grey-green to grey-yellow) and chroma.
retroPanelWeights → const List<int>
[lcd, vfd] weights: the VFD is the minority variant.
retroVfdChromaMilli → const IntRange
retroVfdGhostRatio → const IntRange
retroVfdHueTenths → const IntRange
retroVfdLMilli → const IntRange
VFD panel: dark blue-green glass.
retroVfdSegmentHues → const List<Weighted<int>>
VFD phosphor hues (tenths): cyan, then green.

Functions

buildRetroCandidate(int seed, FamilyDefinition def, int engineVersion, {int attempt = 0, bool accessible = false}) → ThemeSpec
Builds one unvalidated Retro candidate (the generator repairs and validates it, retries with palette/retry/n and finally falls back to a Retro hero).