09bafca21c
# Conflicts: # app/lib/application/app.dart # app/lib/application/detached/detached_app.dart # app/lib/application/pipelines_root.dart # app/lib/features/chat/ui/sessions/chat_color_palette.dart # app/lib/ui/theme/app_design.dart # app/lib/ui/theme/app_design_tokens.dart
62 lines
2.1 KiB
Dart
62 lines
2.1 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)),
|
|
// A blend into or out of the glow passes every text shadow through a
|
|
// near-zero blur; in the browser (skwasm) that corrupted paragraph
|
|
// layout and hung the page within a few live switches.
|
|
snapSwitch: true,
|
|
);
|
|
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),
|
|
);
|
|
}
|