engine/cyberpunk library

The Cyberpunk family (new family, id 13; heroes 130–132): a night-city HUD keypad. Pure Dart: part of the generator, so every constant here is part of the family's engine-v3 definition and must not change without a version bump once v3 ships with it.

  • Body (the scene, BackgroundKind.cyberGrid): a near-black blue-black, teal or plum gradient whose bottom stop (the "street glow", 0.06–0.10 lighter) is tinted by a neon, under a flat 32 dp grid with a brighter line every fourth, routed circuit traces with via rings coming in from the screen edges, and 3 dp scanlines. The seeded light variant, "Hazard", is a warm acid-yellow body (102–107°) with black plates, a black HUD screen and no grid (traces and scanlines only).
  • Plates (digit and function keys): dark chamfered faces (OKLCH L ≤ 0.305) traced by a neon edge line (KeyColors.edge, 1–1.5 dp) that bleeds a halo onto the body; digit labels are near-white (yellow on Hazard), function labels neon.
  • Slabs (operator and = keys): solid neon faces at their hue's chroma cusp with dark labels. OKLCH L: magenta 0.66–0.88 (0.76–0.88 under the Accessible lock), cyan 0.80–0.86 in both modes (the gamut edge, at 95–100 % of its maximum chroma), acid 0.74–0.92 (0.76 on Hazard and under the lock), amber and toxic 0.74–0.88 (0.76 likewise). Fill versus outline is the recorded non-colour cue (OperatorCue.outline), verified by validateCyberpunk as a luminance polarity cue (it survives every colour-vision deficiency), plus a ≥ 200 heavier operator label.
  • Display: an opaque, recessed HUD screen (palette.surface; a cyan-tinted black on Hazard, with yellow text) with faint static scanlines (palette.shadow, translucent lighter rows; none under the Accessible lock), a neon frame (inset behind a black rim on Hazard), corner brackets and a segmented status rule that carries no data.

Neon bands (tenths of a degree): MAGENTA 3260–3440, CYAN 1880–2040, ACID 1000–1150, TOXIC 1350–1550, AMBER 600–740. There is no red or blue slab band, so no saturated-red flash is possible.

BackgroundSpec.colors of the scene: [0] body (top stop, opaque), [1] haze (bottom stop, opaque), [2] grid ink (alpha 0 on Hazard), [3] trace and via ink, [4] scanline ink (all three translucent ARGB). angleTenths tilts the gradient (within ±20°); the grid cell, scan pitch and trace layout are renderer constants; the scene is static (driftPeriodMs 0).

Every draw comes from the generator's named sub-streams (palette and its retry streams, background, shape, style, type, motion, name), so a theme is a pure function of (seed, engineVersion, accessible). The palette draw order is frozen once v3 ships.

Enums

CyberBand
The neon hue bands (tenths of a degree).
CyberVariant
The four sub-variants (engine-internal, never serialised).

Constants

cyberBodyChromaMilli → const List<IntRange>
Dark body chroma (thousandths) per dark variant, in variant order.
cyberBodyHueTenths → const List<IntRange>
Dark body hue bands (tenths) per dark variant, in variant order.
cyberCornerPermille → const IntRange
Chamfer range (fraction of the face's short side × 1000).
cyberDarkVariantWeights → const List<int>
Dark sub-variants [neonNoir, netrunner, afterhours].
cyberEdgeWidthCdp → const IntRange
Neon edge line width range, dp × 100.
cyberGridMaxAlpha → const int
Scene grid ink alpha ceiling (the sample model stays honest).
cyberHaloBlurCdp → const IntRange
Halo blur range, dp × 100 (σ = value / 200 dp).
cyberHazeLiftMilli → const IntRange
The street glow: the haze (bottom stop) is this much lighter than the body in dark themes (OKLCH L, thousandths).
cyberLabelZoneBottom → const double
cyberLabelZoneTop → const double
The key label zone (fraction of the face height): only the opaque face, its contrast-safe flare and hover layers and the perimeter edge line (≤ 3.5 dp in: Hazard plates inset theirs behind a 1.5 dp black rim) may lie between these rows, so contrast(label, face) is the worst case a label ever sits on. Ticks, bloom bands and the hold bar stay in the bands above and below.
cyberMaxAngleTenths → const int
The scene gradient tilts at most this far from vertical (tenths).
cyberOperatorWeightMax → const int
The operator label weight ceiling (Oxanium's wght maximum).
cyberPairs → const Map<CyberVariant, List<Weighted<(CyberBand, CyberBand)>>>
(operator, =) neon pairs per variant.
cyberPanelScanMaxAlpha → const int
Panel scanline ink (palette.shadow) alpha ceiling; 0 under the Accessible lock.
cyberPlateMaxL → const double
Plates (digit and function faces) are never lighter than this (OKLCH L): the polarity half of the operator cue.
cyberpunkDarkRanges → const RoleRanges
Dark ranges: documentation of what buildCyberpunkCandidate draws (the builder never reads them; the generic generator does not run for this family). Lightness in OKLCH thousandths:
cyberpunkDefinition → const FamilyDefinition
Cyberpunk: chamfered keys (top-left and bottom-right cut, 12–24 % of the short side), dark plates traced by a 1–1.5 dp neon edge with a halo, neon slabs for operators and =. Press (Terminal row of the motion brief): hardPress in, the neon flares in frame 1 and the plate plunges 2 dp; release 4000/1.0 (seeded × {0.9, 1, 1.1}) while the glow decays like phosphor on effectsDefault (< 5 % at 120 ms); glyph entry 115 % → 100 % over 60 ms; mech_tactile (no seeded alternate), rigid · 0.6. The palette is built by buildCyberpunkCandidate.
cyberpunkLightRanges → const RoleRanges
Hazard (light) ranges, documented as cyberpunkDarkRanges:
cyberRoleSchemeWeights → const List<int>
Role schemes [edgeFromEq, edgeFromOp] (dark themes; always drawn).
cyberScanMaxAlpha → const int
Scene scanline ink alpha ceiling.
cyberSlabMinL → const double
Slabs (operator and = faces) are never darker than this (OKLCH L).
cyberSlabVsPlateRatio → const double
Slab face contrast against the digit plate (the cue's strength).
cyberTraceMaxAlpha → const int
Scene trace and via ink alpha ceiling.

Functions

buildCyberpunkCandidate(int seed, FamilyDefinition def, int engineVersion, {int attempt = 0, bool accessible = false}) → ThemeSpec
Builds one unvalidated Cyberpunk candidate (the generator repairs and validates it, retries with palette/retry/n and finally falls back to a Cyberpunk hero).
cyberGridSamples(List<int> colors) → List<int>
The 36 opaque colours a key edge, focus ring, toolbar icon or display backdrop can sit over in a cyber grid with colors ([body, haze, grid, trace, scan]), in the renderer's paint order (⊕ = compositeOver): for each stop s in {body, haze, their encoded-sRGB half mix}, the bare stop, a grid line g⊕s and a major grid line g⊕g⊕s (every fourth line is drawn twice), each with and without a trace over it, and the scanline ink over each of those six.
cyberHotRim(int face) → int
The hot rim of a dark-theme slab: oklch(min(0.97, L + 0.09), 0.55·C, h) of its final face.
cyberpunkDisplayBackdrops(ThemeSpec spec, List<int> surfaces, List<int> bgs) → List<int>?
Everything display text of spec may be drawn on: the HUD panel (surfaces) and the panel under its scanline ink (palette.shadow); dark themes add every scene sample (bgs; their display text passes on the bare scene too). Hazard's yellow display text sits only on its opaque black screen, never on the yellow body.
cyberpunkSceneSamples(BackgroundSpec bg) → List<int>?
Guardrail background samples of the family's scene (BackgroundKind.cyberGrid): cyberGridSamples. Null (the generic sampling) for a malformed scene without its five colours; cyberScene rejects those.
repairCyberpunkExtras(Palette p, ThemeSpec spec, GuardrailLimits lim, List<int> bgs) → Palette?
Family repairs after labels and display texts (called from repairTheme for ThemeFamily.cyberpunk specs only); null when unreachable:
validateCyberpunk(ThemeSpec spec, GuardrailLimits lim, List<int> bgs) → List<GuardrailViolation>
The family-specific guardrails (called from validateTheme for ThemeFamily.cyberpunk specs only):