7c42713be3
The full-screen repeating gradient and radial vignette doubled CPU raster time per frame in the browser bench; solid non-AA bands cost about nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
1.9 KiB
Dart
58 lines
1.9 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))
|
|
: 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),
|
|
);
|
|
}
|