Files
pipelines/app/lib/ui/theme/crt_theme.dart
T
alan 9eaa8d18c0 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>
2026-12-03 23:10:57 +00:00

61 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'app_design.dart';
import 'app_design_tokens.dart';
import 'crt_palette.dart';
import 'terminal_theme.dart';
/// Retro CRT's corner radius: square, like a character cell.
const double crtRadius = 0;
/// The Retro CRT design's theme: Terminal's structure (monospace, prompt
/// transcript, flat framed surfaces) in one [phosphor]'s shades, square
/// corners, 1px phosphor frames, a faint glow under every text role and a
/// static scanline pattern over the app ([AppDesignTokens.screen]).
///
/// Dark is the tube: the phosphor glowing on near-black. Light is a
/// "paper-white phosphor": deep phosphor ink on a pale tinted page, without
/// glow (a halo round dark ink reads as smudge) and with scanlines faint
/// enough to read as texture only.
ThemeData crtTheme(
CrtPhosphor phosphor,
AppDesign design,
Brightness brightness,
) {
final scheme = crtColorScheme(phosphor, brightness);
final ramp = CrtRamp(phosphor, brightness);
final dark = brightness == Brightness.dark;
final tokens = AppDesignTokens(
design: design,
radius: crtRadius,
flat: true,
frame: scheme.outlineVariant,
panel: scheme.surfaceContainerLow,
ansi: ramp.ansi,
transcript: TranscriptStyle.prompt,
selectedRow: SelectedRowStyle.framed,
monochrome: ramp.text,
screen: dark
? const ScreenPattern(
scanline: Color(0x29000000),
vignette: Color(0x47000000),
)
: ScreenPattern(scanline: ramp.text.withValues(alpha: 0.035)),
);
final theme = terminalStructureTheme(
scheme,
tokens,
glow: dark
? [Shadow(color: ramp.text.withValues(alpha: 0.38), blurRadius: 3)]
: null,
);
return theme.copyWith(
textSelectionTheme: TextSelectionThemeData(
cursorColor: scheme.primary,
selectionColor: ramp.text.withValues(alpha: dark ? 0.28 : 0.22),
selectionHandleColor: scheme.primary,
),
iconTheme: theme.iconTheme.copyWith(color: scheme.onSurface),
);
}