Terminal theme: pure black, square, monospace, IRC-style chat lines
build / build (push) Successful in 16m14s
build / build (push) Successful in 16m14s
A fourth theme choice "Term" next to System/Light/Dark: - black surfaces, green accent, JetBrains Mono, no rounded corners, compact density and paddings, no ink splash (lib/theme/terminal_theme.dart, built on MeshTheme's dark theme with the shapes overridden); - channel and direct chats render each message as one IRC line across the whole width: "14:02 <nick> text [2 hops] ✓", no avatar, no bubble, own messages on the left too. Route, region, repeat and delivery status follow the text inline; the tracing path stays on its own line. The upstream bubble code is untouched: both chat screens branch to a separate builder when MeshStyle.of(context).terminal, so the nightly upstream merge does not collide with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b519922d51
commit
55386df69f
9 files changed
+762
-6
No files matched your search
@@ -230,6 +230,10 @@ class MeshTheme {
|
||||
return _build(scheme, Brightness.light);
|
||||
}
|
||||
|
||||
/// Base for the tth fork's terminal theme (terminal_theme.dart).
|
||||
static ThemeData buildFrom(ColorScheme scheme, Brightness brightness) =>
|
||||
_build(scheme, brightness);
|
||||
|
||||
static ThemeData _build(ColorScheme scheme, Brightness brightness) {
|
||||
final baseText =
|
||||
Typography.material2021(
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
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: 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)],
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user