Retro CRT design: Terminal on a green or amber phosphor tube
One hue per variant (brightness steps for roles, statuses and chat colours, with cross/ring glyphs where hue alone told status), square corners, 1px phosphor frames, a faint text glow and a static scanline and vignette pattern painted once in its own repaint boundary. Light mode is a paper-white phosphor. Terminal's theme builder is shared, not forked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
# Retro CRT design
|
||||
|
||||
Terminal on a monochrome tube (Settings > Design > Retro CRT, or Retro CRT
|
||||
(amber); the Alt+L switcher lists both). Everything Terminal draws (the
|
||||
prompt line, glyph-led tool rows, framed list rows, flat framed panels, the
|
||||
monospace family) is reused as is; only the colours, the corners, a text glow
|
||||
and a static scanline pattern change.
|
||||
|
||||
## Variants
|
||||
|
||||
Amber is a second registry entry (`retro-crt-amber`), not an option: one enum
|
||||
value and no new setting, store or UI. Both entries build through
|
||||
`crtTheme(phosphor, design, brightness)`; `AppDesign.crtPhosphor` names the
|
||||
phosphor (`CrtPhosphor.green`, hue 135, `#33FF66` text; `CrtPhosphor.amber`,
|
||||
hue 40, `#FFAA00` text).
|
||||
|
||||
## Palette (`crt_palette.dart`)
|
||||
|
||||
Every colour is a shade of the one phosphor hue (`CrtRamp`). Roles differ by
|
||||
brightness only:
|
||||
|
||||
| role | dark tube | light (paper-white phosphor) |
|
||||
| --- | --- | --- |
|
||||
| page / containers | L 3–10 %, barely tinted | L 80–97 %, pale tint |
|
||||
| frames (`outlineVariant`) / `outline` | L 20 % / 32 % | L 70 % / 48 % |
|
||||
| secondary text (`onSurfaceVariant`) | L 42 % | L 28 % |
|
||||
| text (`onSurface`) | `#33FF66` / `#FFAA00` | L 17 % ink |
|
||||
| accent (`primary`) | text + 15 % | L 22 % |
|
||||
| warning (`tertiary`, ANSI yellow) | text + 20 % | L 12 % |
|
||||
| error | L 93 % (near white) | L 7 % (near black) |
|
||||
| success (ANSI green) | text − 16 % | L 28 % |
|
||||
|
||||
Status is never told by hue alone: run states already pair a distinct icon
|
||||
with each colour (`RunStatusIcon`), and under a monochrome design a failed
|
||||
tool line draws a cross and a running one a hollow ring instead of the dot
|
||||
(`TerminalGlyphKind.cross` / `ring`). Errors are also the brightest text.
|
||||
|
||||
Chat colours (`chatMonochromeShade`): each of the 13 names is its own
|
||||
brightness step of the phosphor in picker order (L 30–88 % on the tube, 8–30 %
|
||||
ink on the light page), every step at least 3:1 on the page. Thirteen steps of
|
||||
one hue are distinct but close; neighbouring names are hard to tell apart,
|
||||
which is the honest cost of a monochrome palette.
|
||||
|
||||
## Light mode
|
||||
|
||||
A "paper-white phosphor": deep phosphor ink on a pale tinted page, with the
|
||||
same roles and frames. No glow (a halo around dark ink reads as a smudge) and
|
||||
scanlines at 3.5 % ink, a texture only. Chosen over a dark-only fallback so a
|
||||
device in light mode still gets a light page.
|
||||
|
||||
## Glow and screen
|
||||
|
||||
- Glow: one `Shadow` (phosphor at 38 % alpha, blur 3, no offset) on every
|
||||
text role, tooltip and snack bar text, in dark only. It is a per-glyph mask
|
||||
blur in the text draw, not a layer filter.
|
||||
- Screen (`AppDesignTokens.screen`, `ScreenPattern`): scanlines every 3
|
||||
device pixels (a 1-device-pixel band of 16 % black; snapped to device
|
||||
pixels so they never moiré) and a vignette fading the corners to 28 %
|
||||
black. `DesignScreenOverlay` (in the `MaterialApp.builder` of the app, the
|
||||
connect flow and detached windows) paints it with one `CustomPaint` in its
|
||||
own `RepaintBoundary` above everything (menus and dialogs included),
|
||||
`IgnorePointer`, no semantics: two gradient-filled rectangles, painted
|
||||
once, repainted only on a resize, pixel-ratio or design change. No
|
||||
saveLayer, no filter, no animation (so nothing for reduced motion to stop).
|
||||
The app stays the Stack's first child, so a design switch does not remount
|
||||
it.
|
||||
|
||||
## Tokens added to `AppDesignTokens` (defaults keep every other design)
|
||||
|
||||
- `monochrome` (`Color?`, default null): the one hue; chat colours become its
|
||||
brightness steps and hue-only statuses get glyphs.
|
||||
- `screen` (`ScreenPattern?`, default null): the static overlay pattern.
|
||||
|
||||
Retro CRT also sets: `radius: 0`, `flat`, `frame: outlineVariant`, `panel:
|
||||
surfaceContainerLow`, `ansi` (brightness steps above), `transcript: prompt`,
|
||||
`selectedRow: framed`, the default `pill` composer and `>` prompt glyph.
|
||||
|
||||
## Terminal reuse
|
||||
|
||||
`terminalTheme` is now `terminalStructureTheme(scheme, tokens, {glow})`
|
||||
called with Terminal's scheme and tokens (Terminal's theme is value-equal to
|
||||
before); the corners come from `tokens.radius`, the frame from
|
||||
`tokens.frame`, and the tab indicator cache keys on the accent instead of
|
||||
the brightness. `terminalTextTheme` takes the optional glow.
|
||||
|
||||
## Square details
|
||||
|
||||
- Corners 0 everywhere the theme reaches (buttons, chips, menus, dialogs,
|
||||
sheets, tooltips, snack bars, inputs, cards, nav indicators, stack discs
|
||||
and labels, count badges).
|
||||
- Send button usage ring: a square button keeps a square ring (radius 0, not
|
||||
the gap-offset 4 px), 3 px clear gap.
|
||||
- Graph edge hover: the stage glow is square under a 0 radius.
|
||||
- Artifact tile thumbnails: the inner clip radius clamps at 0 (it was
|
||||
`radius - 1`, negative under a square design).
|
||||
|
||||
## Still default / known gaps
|
||||
|
||||
- Terminal's own spacings are kept, including the prompt line's 10/6/12 px
|
||||
padding (off the 4/8 grid); changing them would change Terminal.
|
||||
- The design picker's swatch previews keep their 6 px corners (they preview
|
||||
every design), and Material `Badge` counts (Artifacts) stay round: the
|
||||
badge theme has no shape.
|
||||
- The text cursor is the theme's line cursor in the accent colour; a block
|
||||
cursor needs a per-field `cursorWidth`, not a theme value.
|
||||
- Snack bars follow the theme (square, framed, glowing text) but were not
|
||||
captured.
|
||||
- Code and diff syntax colours keep their own palette where they set one.
|
||||
|
||||
## Checks
|
||||
|
||||
- `test/ui/theme/retro_crt_design_test.dart`: registry, tokens, one hue,
|
||||
contrast (text > 7:1, secondary > 4.5:1), status brightness steps, glow,
|
||||
chat colour steps, cross/ring glyphs (and Terminal keeps dots).
|
||||
- `test/ui/theme/design_screen_overlay_test.dart`: the pattern is one
|
||||
boundary, adds no saveLayer, is not repainted while content scrolls, lets
|
||||
pointers through, and a design switch does not remount the app.
|
||||
- `test/perf/design_bench_test.dart` picks up both entries; see the report
|
||||
for the browser bench.
|
||||
Reference in New Issue
Block a user