Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6.7 KiB
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é).DesignScreenOverlay(in theMaterialApp.builderof the app, the connect flow and detached windows) paints it with oneCustomPaintin its ownRepaintBoundaryabove everything (menus and dialogs included),IgnorePointer, no semantics: one solid, non-anti-aliased path of thin rectangles, recorded once and re-recorded only on a resize, pixel-ratio or design change. No saveLayer, no shader, 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. - No vignette. The first version drew the scanlines as a full-screen repeating gradient plus a full-screen radial vignette; the browser bench showed those two shaded fills, replayed every frame, more than doubled the CPU raster time of scrolling (an experiment build with the overlay but no glow: 77 ms vs Terminal's 33 ms raster per frame; with the glow but no overlay: 30 ms, i.e. the glow is about free). Solid bands fixed it; the vignette was optional and is dropped.
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, and
snapSwitch: true (High contrast's token): a live switch into or out of
Retro CRT snaps instead of blending. Blending the glow lerps every text
shadow through a near-zero blur, and in the browser bench's design
scenario (rapid live switches) skwasm then threw "memory access out of
bounds" in paragraph layout and the page stopped answering. An experiment
build without the glow passed the same scenario; with the snap it passes
with the glow.
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
Badgecounts (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/ui/theme/compact_switch_test.dartandhigh_contrast_switch_test.dartswitch live into and out of both entries frame by frame.test/perf/design_bench_test.dartpicks up both entries; see the report for the browser bench.