Files
tthandClaude Opus 5.5 e939932cef
build / build (push) Successful in 17m24s
Terminal theme: flat lists, compact settings, one-line reply quote
In the terminal theme only:
- MeshCard becomes a flat row with a rule underneath: no margin, no
  corners, 8/4 padding. Channel and contact lists, settings groups and
  every other card shrink to about half their height.
- AvatarCircle is just the glyph (icon or initials, at most 20 px), the
  contact emoji avatar likewise.
- MeshNavTile and SectionHeader: smaller icons, padding and type.
- Text line height 1.2 instead of Material's 1.4-1.5.
- A reply in a channel is one dim line above the message,
  "↳ <nick> quoted text…", instead of the boxed preview; the
  "replying to" banner above the composer loses its padding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 12:28:24 +02:00

255 lines
8.6 KiB
Dart

import 'package:flutter/material.dart';
import 'mesh_theme.dart';
/// Terminal theme of the tth fork: pure black, square corners, monospace,
/// minimal padding, and IRC-style chat lines (see [TerminalMessageLine]).
///
/// Kept out of mesh_theme.dart so the nightly upstream merge does not collide
/// with it: it is the dark theme with the shapes and colours overridden.
class TerminalPalette {
TerminalPalette._();
static const bg = Color(0xFF000000);
static const bg1 = Color(0xFF0A0A0A);
static const bg2 = Color(0xFF141414);
static const bg3 = Color(0xFF1F1F1F);
static const line = Color(0xFF262626);
static const line2 = Color(0xFF3A3A3A);
static const ink = Color(0xFFD4D4D4);
static const ink2 = Color(0xFF9E9E9E);
static const green = Color(0xFF4ADE80);
static const greenDim = Color(0xFF16A34A);
}
/// Lets widgets ask whether the terminal look is active.
@immutable
class MeshStyle extends ThemeExtension<MeshStyle> {
final bool terminal;
const MeshStyle({required this.terminal});
static const _default = MeshStyle(terminal: false);
static MeshStyle of(BuildContext context) =>
Theme.of(context).extension<MeshStyle>() ?? _default;
@override
MeshStyle copyWith({bool? terminal}) =>
MeshStyle(terminal: terminal ?? this.terminal);
@override
MeshStyle lerp(MeshStyle? other, double t) =>
t < 0.5 ? this : (other ?? this);
}
ThemeData terminalTheme() {
const scheme = ColorScheme.dark(
primary: TerminalPalette.green,
onPrimary: Colors.black,
primaryContainer: Color(0xFF052E16),
onPrimaryContainer: TerminalPalette.green,
secondary: MeshPalette.magenta,
onSecondary: Colors.black,
secondaryContainer: Color(0xFF2A0F2A),
onSecondaryContainer: Colors.white,
tertiary: MeshPalette.warn,
onTertiary: Colors.black,
tertiaryContainer: Color(0xFF3B2405),
onTertiaryContainer: Colors.white,
error: MeshPalette.alert,
onError: Colors.black,
errorContainer: Color(0xFF3B0A0A),
onErrorContainer: Colors.white,
surface: TerminalPalette.bg,
onSurface: TerminalPalette.ink,
surfaceContainerLowest: TerminalPalette.bg,
surfaceContainerLow: TerminalPalette.bg,
surfaceContainer: TerminalPalette.bg1,
surfaceContainerHigh: TerminalPalette.bg2,
surfaceContainerHighest: TerminalPalette.bg3,
onSurfaceVariant: TerminalPalette.ink2,
outline: TerminalPalette.line2,
outlineVariant: TerminalPalette.line,
shadow: Colors.black,
scrim: Colors.black87,
inverseSurface: TerminalPalette.ink,
onInverseSurface: TerminalPalette.bg,
inversePrimary: TerminalPalette.greenDim,
);
final base = MeshTheme.buildFrom(scheme, Brightness.dark);
const square = RoundedRectangleBorder();
const mono = TextStyle(
fontFamily: MeshFonts.mono,
fontFamilyFallback: MeshFonts.monoFallback,
);
TextStyle? toMono(TextStyle? s) => s?.merge(mono);
ButtonStyle squareButton(ButtonStyle? s, EdgeInsets padding) =>
(s ?? const ButtonStyle()).copyWith(
shape: const WidgetStatePropertyAll(square),
padding: WidgetStatePropertyAll(padding),
textStyle: s?.textStyle == null
? null
: WidgetStateProperty.resolveWith(
(states) => toMono(s!.textStyle!.resolve(states)),
),
);
OutlineInputBorder inputBorder(Color color, [double width = 1]) =>
OutlineInputBorder(
borderRadius: BorderRadius.zero,
borderSide: BorderSide(color: color, width: width),
);
return base.copyWith(
visualDensity: VisualDensity.compact,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
splashFactory: NoSplash.splashFactory,
textTheme: _tightLines(
base.textTheme.apply(
fontFamily: MeshFonts.mono,
fontFamilyFallback: MeshFonts.monoFallback,
),
),
appBarTheme: base.appBarTheme.copyWith(
toolbarHeight: 48,
titleSpacing: 8,
titleTextStyle: toMono(
base.appBarTheme.titleTextStyle,
)?.copyWith(fontSize: 16, letterSpacing: 0),
),
cardTheme: base.cardTheme.copyWith(
shape: const RoundedRectangleBorder(
side: BorderSide(color: TerminalPalette.line),
),
margin: const EdgeInsets.symmetric(vertical: 2),
),
listTileTheme: base.listTileTheme.copyWith(
shape: square,
dense: true,
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
horizontalTitleGap: 8,
minVerticalPadding: 2,
),
floatingActionButtonTheme: base.floatingActionButtonTheme.copyWith(
shape: square,
extendedTextStyle: toMono(
base.floatingActionButtonTheme.extendedTextStyle,
),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: squareButton(
base.elevatedButtonTheme.style,
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
),
),
filledButtonTheme: FilledButtonThemeData(
style: squareButton(
base.filledButtonTheme.style,
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: squareButton(
base.outlinedButtonTheme.style,
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
),
),
textButtonTheme: TextButtonThemeData(
style: squareButton(
base.textButtonTheme.style,
const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
),
),
iconButtonTheme: const IconButtonThemeData(
style: ButtonStyle(shape: WidgetStatePropertyAll(square)),
),
segmentedButtonTheme: SegmentedButtonThemeData(
style: squareButton(
base.segmentedButtonTheme.style,
const EdgeInsets.symmetric(horizontal: 8),
),
),
inputDecorationTheme: base.inputDecorationTheme.copyWith(
fillColor: TerminalPalette.bg,
contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
isDense: true,
border: inputBorder(scheme.outline),
enabledBorder: inputBorder(scheme.outlineVariant),
focusedBorder: inputBorder(scheme.primary),
disabledBorder: inputBorder(scheme.outlineVariant),
errorBorder: inputBorder(scheme.error),
focusedErrorBorder: inputBorder(scheme.error),
),
chipTheme: base.chipTheme.copyWith(
shape: square,
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 0),
labelStyle: toMono(base.chipTheme.labelStyle),
),
navigationBarTheme: base.navigationBarTheme.copyWith(
height: 56,
indicatorShape: square,
labelTextStyle: WidgetStateProperty.resolveWith(
(states) =>
toMono(base.navigationBarTheme.labelTextStyle?.resolve(states)),
),
),
bottomSheetTheme: base.bottomSheetTheme.copyWith(
shape: const RoundedRectangleBorder(
side: BorderSide(color: TerminalPalette.line2),
),
),
dialogTheme: base.dialogTheme.copyWith(
shape: const RoundedRectangleBorder(
side: BorderSide(color: TerminalPalette.line2),
),
insetPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
),
snackBarTheme: base.snackBarTheme.copyWith(
shape: const RoundedRectangleBorder(
side: BorderSide(color: TerminalPalette.line2),
),
),
popupMenuTheme: base.popupMenuTheme.copyWith(
shape: const RoundedRectangleBorder(
side: BorderSide(color: TerminalPalette.line2),
),
),
tooltipTheme: base.tooltipTheme.copyWith(
decoration: BoxDecoration(
color: TerminalPalette.bg2,
border: Border.all(color: TerminalPalette.line2),
),
),
tabBarTheme: base.tabBarTheme.copyWith(
labelStyle: toMono(base.tabBarTheme.labelStyle),
unselectedLabelStyle: toMono(base.tabBarTheme.unselectedLabelStyle),
labelPadding: const EdgeInsets.symmetric(horizontal: 8),
),
extensions: const [MeshStyle(terminal: true)],
);
}
/// Material's 1.4-1.5 line height is what makes list rows tall; a terminal
/// runs at ~1.2.
TextTheme _tightLines(TextTheme t) {
TextStyle? tight(TextStyle? s) => s?.copyWith(height: 1.2);
return t.copyWith(
displayLarge: tight(t.displayLarge),
displayMedium: tight(t.displayMedium),
displaySmall: tight(t.displaySmall),
headlineLarge: tight(t.headlineLarge),
headlineMedium: tight(t.headlineMedium),
headlineSmall: tight(t.headlineSmall),
titleLarge: tight(t.titleLarge),
titleMedium: tight(t.titleMedium),
titleSmall: tight(t.titleSmall),
bodyLarge: tight(t.bodyLarge),
bodyMedium: tight(t.bodyMedium),
bodySmall: tight(t.bodySmall),
labelLarge: tight(t.labelLarge),
labelMedium: tight(t.labelMedium),
labelSmall: tight(t.labelSmall),
);
}