Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(desktop): light mode, and Dark/Light terminal schemes (#248)

bubu-dudu2b2c6ca7c726
diff --git a/desktop/lib/app_shell.dart b/desktop/lib/app_shell.dart
index 7dda09000..1e9704b8e 100644
--- a/desktop/lib/app_shell.dart
+++ b/desktop/lib/app_shell.dart
@@ -125,9 +125,9 @@ class HarnessApp extends StatelessWidget {
),
// The design system's own `buildAppTheme` — see the note where a second,
// hand-written `ThemeData` used to shadow it, in `lib/theme/app_theme.dart`.
- // Harness Desktop is dark-only: one theme, no `darkTheme`/`themeMode` to
- // resolve between.
- theme: grid.buildAppTheme(brightness: Brightness.dark),
+ // One theme, no `darkTheme`/`themeMode` to resolve between: the chosen
+ // palette says whether it is light or dark.
+ theme: grid.buildAppTheme(brightness: prefs.palette.brightness),
// The chosen point size is already applied to every style and terminal
// cell. A second UI scale would make the chrome disagree with the grid.
builder: (context, child) => MediaQuery.withNoTextScaling(
@@ -154,9 +154,9 @@ class HarnessApp extends StatelessWidget {
/// mounted with. [grid.BrightnessScope] marks the ones that called
/// `AppTheme.watch` dirty directly, across that boundary.
///
-/// Pinned to [Brightness.dark] rather than read from `Theme.of(context)`:
-/// Harness Desktop is dark-only, and there is no other theme for `Theme.of`
-/// to ever resolve to here.
+/// Set from the palette rather than read from `Theme.of(context)`: the palette
+/// is where light or dark is chosen, and [HarnessApp] builds the theme from the
+/// same value, so the two cannot disagree.
class _GridTokenScope extends StatelessWidget {
const _GridTokenScope({required this.child});
@@ -164,7 +164,7 @@ class _GridTokenScope extends StatelessWidget {
@override
Widget build(BuildContext context) {
- grid.AppTheme.brightness.value = Brightness.dark;
+ grid.AppTheme.brightness.value = grid.AppTheme.palette.value.brightness;
return grid.BrightnessScope(child: child);
}
}
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index f51ec6324..779fdc7bc 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -194,9 +194,24 @@ typedef _NewHarnessContext = ({
String? projectName,
});
-/// The command box's title line, a step quieter than the rows under it.
-TextStyle get _boxCaption =>
- grid.AppType.monoLabel(color: kBoxFaint, fontWeight: FontWeight.w400);
+/// The command box's title line, a step quieter than the rows under it. The
+/// box is drawn on the terminal's ground, so its muted ink comes from there.
+TextStyle get _boxCaption => grid.AppType.monoLabel(
+ color: terminalThemeFor(
+ grid.AppTheme.palette.value,
+ terminalThemeStore.value,
+ ).muted,
+ fontWeight: FontWeight.w400,
+);
+
+/// The veil a workspace dialog drops over the panes behind it. Near-black on a
+/// dark palette; on a light one a near-black sheet would be the loudest thing
+/// on screen, so it is the workspace's own grey, which still sits a step below
+/// the dialog's lighter ground.
+Color get _workspaceVeil => grid.AppTheme.pick(
+ grid.AppPalette.swarmField,
+ Colors.black,
+).withValues(alpha: .94);
class _SwarmScreenState extends State<SwarmScreen> {
static const _channel = MethodChannel('harness/swarm_tabs');
@@ -2796,9 +2811,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
},
// Keep the workspace quiet behind the focused pane.
- child: ColoredBox(
- color: Colors.black.withValues(alpha: .94),
- ),
+ child: ColoredBox(color: _workspaceVeil),
),
),
),
@@ -5137,9 +5150,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
key: const ValueKey('swarm-search-dismiss'),
behavior: HitTestBehavior.opaque,
onTap: _dismissSearch,
- child: ColoredBox(
- color: Colors.black.withValues(alpha: .94),
- ),
+ child: ColoredBox(color: _workspaceVeil),
),
),
),
@@ -5247,8 +5258,13 @@ class _SwarmScreenState extends State<SwarmScreen> {
)
.firstOrNull;
if (destination == null) return false;
- final readToken = app.agentUnread.readTokenFor(row.machineId, row.agentId);
- final questionId = app.questionFor(row.machineId, row.agentId)?.requestId;
+ final readToken = app.agentUnread.readTokenFor(
+ row.machineId,
+ row.agentId,
+ );
+ final questionId = app
+ .questionFor(row.machineId, row.agentId)
+ ?.requestId;
final opened = await activateSwarmDestination(
app,
destination,
@@ -5257,9 +5273,15 @@ class _SwarmScreenState extends State<SwarmScreen> {
// Opening acknowledges this notification. Its question stays pending
// until the daemon confirms an answer, independently of unread state.
if (opened &&
- app.agentUnread.readTokenFor(row.machineId, row.agentId) == readToken &&
- app.questionFor(row.machineId, row.agentId)?.requestId == questionId) {
- app.readAgentNotification(row.machineId, row.agentId, readToken: readToken);
+ app.agentUnread.readTokenFor(row.machineId, row.agentId) ==
+ readToken &&
+ app.questionFor(row.machineId, row.agentId)?.requestId ==
+ questionId) {
+ app.readAgentNotification(
+ row.machineId,
+ row.agentId,
+ readToken: readToken,
+ );
}
return opened;
},
@@ -5951,10 +5973,14 @@ class _SwarmScreenState extends State<SwarmScreen> {
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
children: [
- const Icon(
+ Icon(
Icons.info_outline,
size: 16,
- color: Colors.orangeAccent,
+ // Orange is ~1.8:1 on a light panel.
+ color: grid.AppTheme.pick(
+ grid.AppPalette.warn,
+ Colors.orangeAccent,
+ ),
),
const SizedBox(width: 10),
Expanded(
diff --git a/desktop/lib/settings/appearance/palette_section.dart b/desktop/lib/settings/appearance/palette_section.dart
index 14b8faa78..69ee62ed3 100644
--- a/desktop/lib/settings/appearance/palette_section.dart
+++ b/desktop/lib/settings/appearance/palette_section.dart
@@ -81,12 +81,17 @@ class _PaletteChoice extends StatelessWidget {
style: ButtonStyle(
padding: const WidgetStatePropertyAll(EdgeInsets.all(8)),
backgroundColor: WidgetStatePropertyAll(palette.panel),
- overlayColor: const WidgetStatePropertyAll(Colors.white10),
+ // Each card is drawn in its own palette, so its ink is that
+ // palette's foreground — white on the dark ones, near-black on
+ // the light ones — whatever the app is wearing.
+ overlayColor: WidgetStatePropertyAll(
+ palette.foreground.withValues(alpha: .10),
+ ),
side: WidgetStateProperty.resolveWith(
(states) => BorderSide(
color: selected || states.contains(WidgetState.focused)
? palette.accent
- : Colors.white12,
+ : palette.foreground.withValues(alpha: .12),
width: selected || states.contains(WidgetState.focused)
? 1.5
: 1,
@@ -106,7 +111,7 @@ class _PaletteChoice extends StatelessWidget {
Expanded(
child: Text(
palette.label,
- style: grid.AppType.label(color: Colors.white),
+ style: grid.AppType.label(color: palette.foreground),
),
),
SizedBox(
@@ -153,8 +158,8 @@ class _WorkspacePreview extends StatelessWidget {
child: Container(
width: 3,
height: 3,
- decoration: const BoxDecoration(
- color: Colors.white38,
+ decoration: BoxDecoration(
+ color: palette.foreground.withValues(alpha: .38),
shape: BoxShape.circle,
),
),
@@ -214,7 +219,9 @@ class _WorkspacePreview extends StatelessWidget {
widthFactor: 0.85,
child: Container(
height: 2,
- color: Colors.white54,
+ color: palette.foreground.withValues(
+ alpha: .54,
+ ),
),
),
const SizedBox(height: 4),
@@ -222,7 +229,9 @@ class _WorkspacePreview extends StatelessWidget {
widthFactor: 0.6,
child: Container(
height: 2,
- color: Colors.white30,
+ color: palette.foreground.withValues(
+ alpha: .30,
+ ),
),
),
],
diff --git a/desktop/lib/settings/appearance/wallpaper_section.dart b/desktop/lib/settings/appearance/wallpaper_section.dart
index 7374dcda6..42e01df37 100644
--- a/desktop/lib/settings/appearance/wallpaper_section.dart
+++ b/desktop/lib/settings/appearance/wallpaper_section.dart
@@ -154,12 +154,17 @@ class _BackgroundCard extends StatelessWidget {
children: [
preview,
if (selected)
- const Positioned(
+ Positioned(
right: 8,
bottom: 8,
+ // White vanishes on a light palette's plain field
+ // (1.25:1); its deep accent holds 5.1:1 or better.
child: Icon(
Icons.check_circle,
- color: Colors.white,
+ color: grid.AppTheme.pick(
+ grid.AppPalette.swarmAccent,
+ Colors.white,
+ ),
size: 20,
),
),
diff --git a/desktop/lib/settings/sections/terminal_section.dart b/desktop/lib/settings/sections/terminal_section.dart
index 1c6a4d1a7..dbd79a9f2 100644
--- a/desktop/lib/settings/sections/terminal_section.dart
+++ b/desktop/lib/settings/sections/terminal_section.dart
@@ -249,9 +249,9 @@ class _Screen extends StatelessWidget {
// This sample used to borrow `AppPalette` — fine while the terminal always
// borrowed it too, and a lie the moment a scheme of its own could be
// chosen: a user picking Tango would have been shown Harness's ground and
- // told that was the result. `terminalThemeFor` is the same call the real
- // pane makes, so what is judged here is what will be rendered.
- final theme = terminalThemeFor(grid.AppTheme.palette.value, scheme);
+ // told that was the result. `terminalScreenThemeFor` is the same call the
+ // real pane makes, so what is judged here is what will be rendered.
+ final theme = terminalScreenThemeFor(grid.AppTheme.palette.value, scheme);
final base = style.toTextStyle(color: theme.foreground);
final dim = style.toTextStyle(color: theme.brightBlack);
final ok = style.toTextStyle(color: theme.green);
diff --git a/desktop/lib/shared/theme/app_theme.dart b/desktop/lib/shared/theme/app_theme.dart
index df8eac95d..f4be5248d 100644
--- a/desktop/lib/shared/theme/app_theme.dart
+++ b/desktop/lib/shared/theme/app_theme.dart
@@ -6,8 +6,9 @@ export 'app_type.dart';
import 'color_palette.dart';
/// The app's live brightness — the single source of truth the color tokens below
-/// resolve against. Harness Desktop is dark-only: `_GridTokenScope` (in
-/// `main.dart`) pins this to [Brightness.dark] once, at the top of the tree.
+/// resolve against. The palette decides it: `_GridTokenScope` (in
+/// `app_shell.dart`) sets this from [palette]'s own brightness, so a light
+/// palette ([HarnessPalette.paper], [HarnessPalette.mist]) is a light app.
///
/// Every `AppPalette`/`AppSurface`/`AppGlass`/`AppCard` member is a getter that
/// switches on this, so a call site like `color: AppPalette.windowBg` follows the
@@ -161,8 +162,11 @@ abstract final class AppPalette {
static Color get swarmAccent => AppTheme.palette.value.accent;
// Shared with the native search field for a continuous input/results surface.
static Color get swarmSearchSurface => AppTheme.palette.value.search;
- static const agentEntrySurface = Color(0xff101113);
- static const agentEntryField = Color(0xff1d1f22);
+ // Getters, not consts: a light palette brings its own panel and card.
+ static Color get agentEntrySurface =>
+ AppTheme.pick(AppTheme.palette.value.panel, const Color(0xff101113));
+ static Color get agentEntryField =>
+ AppTheme.pick(AppTheme.palette.value.card, const Color(0xff1d1f22));
// The command field deliberately stays light, like a browser's new-tab omnibox.
static const commandField = Color(0xFFF7F8FA);
static const commandInk = Color(0xFF202124);
@@ -177,20 +181,20 @@ abstract final class AppPalette {
// (#141414) is now *darker* than the page it sits on. Depth in dark is
// therefore carried by the rim and the shadow, not by the fill — §2's stack
// still holds, it just has less room to say it in.
- static Color get windowBg =>
- AppTheme.pick(const Color(0xFFFFFFFF), AppTheme.palette.value.background);
+ //
+ // These four come from the palette in both themes: a light palette carries
+ // its own light surfaces (color_palette.dart), and it is the palette that
+ // decides the brightness in the first place.
+ static Color get windowBg => AppTheme.palette.value.background;
// sidebar column — a barely-there cool grey (Codex keeps the rail almost white,
// set apart by a hairline, not a tone) / charcoal panel in dark.
- static Color get panelBg =>
- AppTheme.pick(const Color(0xFFF9F9F8), AppTheme.palette.value.panel);
+ static Color get panelBg => AppTheme.palette.value.panel;
// input fills, quiet cards
- static Color get cardBg =>
- AppTheme.pick(const Color(0xFFF3F3F2), AppTheme.palette.value.card);
+ static Color get cardBg => AppTheme.palette.value.card;
- static Color get cardBgHover =>
- AppTheme.pick(const Color(0xFFECECEA), AppTheme.palette.value.hover);
+ static Color get cardBgHover => AppTheme.palette.value.hover;
// A hairline separator. Light: a faint cool black; dark: a faint white — a
// black divider would vanish on charcoal.
@@ -248,8 +252,7 @@ abstract final class AppPalette {
/// row, still plainly the same indigo. [accent] can't simply take this value:
/// it is the fill under white text in ~100 places, and lightening it there
/// would drop that text to ~3.1:1 — fixing the icon by breaking the buttons.
- static Color get accentOnSurface =>
- AppTheme.pick(const Color(0xFF2F5BEA), AppTheme.palette.value.accent);
+ static Color get accentOnSurface => AppTheme.palette.value.accent;
// avatar fill (white text on it); a touch brighter in dark for contrast.
static Color get accentMuted =>
@@ -312,25 +315,32 @@ abstract final class AppPalette {
static Color get accentHover =>
AppTheme.pick(const Color(0xFF2850D8), const Color(0xFF4166F2));
+ // These three are drawn as TEXT as often as dots (status labels, ledger
+ // rows), so their light values clear 4.5:1 on the deepest light-palette
+ // ground they meet — Paper's search #E2E2DF / Mist's #DCE4EE — not only on
+ // white: teal 4.90, online 5.02, warn 4.93 there (6.4–6.5 on white).
+
// "Owner" badge — a teal that stays legible on either surface.
static Color get teal =>
- AppTheme.pick(const Color(0xFF0F766E), const Color(0xFF2DD4BF));
+ AppTheme.pick(const Color(0xFF0D6B63), const Color(0xFF2DD4BF));
// green "connected" dot
static Color get online =>
- AppTheme.pick(const Color(0xFF15803D), const Color(0xFF3FB950));
+ AppTheme.pick(const Color(0xFF146C34), const Color(0xFF3FB950));
// expiring soon
static Color get warn =>
- AppTheme.pick(const Color(0xFFB45309), const Color(0xFFFFB020));
+ AppTheme.pick(const Color(0xFF9A4708), const Color(0xFFFFB020));
- // grey dot
+ // grey dot — a state mark, so ≥3:1 in light (3.14 on Paper's search ground).
static Color get offline =>
- AppTheme.pick(const Color(0xFFA3A29C), const Color(0xFF6E6E6E));
+ AppTheme.pick(const Color(0xFF7F7E78), const Color(0xFF6E6E6E));
// Grid brand lightning gold — the live/active ⚡ mark, matching the tray bolt.
+ // Light is a deeper gold than the tray's: #C98A00 was 2.27–2.95:1 on the
+ // light grounds, this is 3.93 at worst.
static Color get brandBolt =>
- AppTheme.pick(const Color(0xFFC98A00), const Color(0xFFE0A93B));
+ AppTheme.pick(const Color(0xFF946500), const Color(0xFFE0A93B));
static Color get textPrimary =>
AppTheme.pick(const Color(0xFF1A1A18), const Color(0xFFF5F5F5));
@@ -338,8 +348,13 @@ abstract final class AppPalette {
static Color get textSecondary =>
AppTheme.pick(const Color(0xFF62615B), const Color(0xFFA8A8A2));
+ /// Meta text and hints. Light is #7A7973, not the #8E8D86 it was: that one
+ /// was tuned for a white page and fell to 2.57:1 on Paper's search ground
+ /// (#E2E2DF) and 2.60 on Mist's (#DCE4EE). This holds 3.36 / 3.40 there and
+ /// 3.49 / 3.51 on the two workspaces, and stays 1.42:1 apart from
+ /// [textSecondary] so the three steps still read as three.
static Color get textFaint =>
- AppTheme.pick(const Color(0xFF8E8D86), const Color(0xFF6E6E68));
+ AppTheme.pick(const Color(0xFF7A7973), const Color(0xFF6E6E68));
/// The page a document is drawn on, and the ink on it.
///
@@ -409,9 +424,9 @@ abstract final class AppPalette {
/// [buildAppTheme] needs the values *before* the global brightness is the one
/// being built for — see the note at its `scrollbarTheme`. The getters below read
/// these same four, so there is one set of numbers rather than two that can drift.
-const Color _scrollThumbLight = Color(0xFF8C8C8C);
+const Color _scrollThumbLight = Color(0xFF787878);
const Color _scrollThumbDark = Color(0xFF686868);
-const Color _scrollThumbHoverLight = Color(0xFF6E6E6E);
+const Color _scrollThumbHoverLight = Color(0xFF5E5E5E);
const Color _scrollThumbHoverDark = Color(0xFF8A8A8A);
/// Surface tokens for the app's chrome — the sidebar's rows, the composer card,
@@ -479,6 +494,9 @@ abstract final class AppSurface {
/// barely dents a white one, so reaching 3:1 needs 0.40 in dark and 0.50 in
/// light. These are those two values resolved — 3.55:1 dark, 3.36:1 light —
/// stated as colours so a list on the panel measures the same as one on the page.
+ /// Light was since deepened (#8C8C8C → #787878) for the light palettes'
+ /// tinted grounds: the old thumb fell to 2.69:1 on Paper's workspace; this
+ /// one holds 3.53 there and 3.55 on Mist's.
static Color get scrollThumb =>
AppTheme.pick(_scrollThumbLight, _scrollThumbDark);
@@ -894,20 +912,22 @@ ThemeData buildAppTheme({Brightness brightness = Brightness.light}) {
outlineVariant: const Color(0x14FFFFFF),
error: const Color(0xFFF2544B),
)
- : const ColorScheme.light(
+ : ColorScheme.light(
primary: AppPalette.accent,
onPrimary: Colors.white,
secondary: AppPalette.accent,
- // Pure white — matches AppPalette.windowBg so the chat pane (which
- // paints scheme.surface) reads as clean white, letting the composer's
- // rim and shadow stand out instead of blending into an off-white wash.
- surface: Color(0xFFFFFFFF),
- onSurface: Color(0xFF1A1A18),
- onSurfaceVariant: Color(0xFF62615B),
- surfaceContainerHighest: Color(0xFFF3F3F2),
- outline: Color(0x0F000000),
- outlineVariant: Color(0x0F000000),
- error: Color(0xFFB3261E),
+ // The light palette's own ground — matches AppPalette.windowBg, as
+ // the dark scheme's does.
+ surface: AppTheme.palette.value.background,
+ onSurface: AppTheme.palette.value.foreground,
+ onSurfaceVariant: const Color(0xFF62615B),
+ // The field fill. Not the card, which is pure white on both light
+ // palettes: a white field in a white dialog has no edge at all. The
+ // panel tone is the step the old light theme's #F3F3F2 was.
+ surfaceContainerHighest: AppTheme.palette.value.panel,
+ outline: const Color(0x0F000000),
+ outlineVariant: const Color(0x0F000000),
+ error: const Color(0xFFB3261E),
);
// The chrome fills used by menus, dialogs and toasts. A getter-backed token
@@ -921,9 +941,7 @@ ThemeData buildAppTheme({Brightness brightness = Brightness.light}) {
// both were `#1E1E1E`, which is [AppCard.base] — a content card's colour, one
// step *below* the block it was supposed to be.
final panelFill = isDark ? AppMenu.fillDark : AppMenu.fillLight;
- final dialogFill = isDark
- ? AppTheme.palette.value.card
- : const Color(0xFFFFFFFF);
+ final dialogFill = AppTheme.palette.value.card;
final textTheme = _appTextTheme(scheme.onSurface, scheme.onSurfaceVariant);
return ThemeData(
@@ -1072,7 +1090,9 @@ ThemeData buildAppTheme({Brightness brightness = Brightness.light}) {
trackColor: WidgetStateProperty.resolveWith(
(s) => s.contains(WidgetState.selected)
? AppPalette.accent
- : (isDark ? const Color(0xFF3A3A3A) : const Color(0xFFA3A29C)),
+ // Light's off track is a UI mark (3:1): #A3A29C was 2.56 on a
+ // white dialog; #858480 is 3.74 there, 3.37 on the panel.
+ : (isDark ? const Color(0xFF3A3A3A) : const Color(0xFF858480)),
),
trackOutlineColor: WidgetStateProperty.all(Colors.transparent),
),
@@ -1089,8 +1109,10 @@ ThemeData buildAppTheme({Brightness brightness = Brightness.light}) {
// (The typed text is set on the field via
// [kFieldTextStyle]; `InputDecorationTheme` has no `style` of its own, so
// a field's own text can't be themed globally here.)
+ // 75% in light: at 70% the hint sat at 2.999:1 on Mist's panel-toned
+ // fill; this is 3.29 (Mist) / 3.29 (Paper). Dark keeps 70% (3.99:1).
hintStyle: _fieldTextStyle(
- scheme.onSurfaceVariant.withValues(alpha: 0.7),
+ scheme.onSurfaceVariant.withValues(alpha: isDark ? 0.7 : 0.75),
),
// Material builds a field for a phone: its default padding, plus the 48px
// touch target it gives a prefixIcon, rendered this 48 tall next to a 32px
diff --git a/desktop/lib/shared/theme/color_palette.dart b/desktop/lib/shared/theme/color_palette.dart
index 2a1bcf10b..59ea94b6e 100644
--- a/desktop/lib/shared/theme/color_palette.dart
+++ b/desktop/lib/shared/theme/color_palette.dart
@@ -1,7 +1,13 @@
+import 'dart:ui' show Brightness;
+
import 'package:flutter/painting.dart';
/// Coordinated workspace colors. These feed the existing design-system tokens,
/// native tabs/search, and terminal defaults; they do not change agent state.
+///
+/// A palette carries its own [brightness]: choosing a light one is how the app
+/// goes light. There is no separate light/dark switch to disagree with it —
+/// `_GridTokenScope` (app_shell.dart) and the native window read it from here.
enum HarnessPalette {
graphite(
'Graphite',
@@ -74,11 +80,45 @@ enum HarnessPalette {
tabBar: Color(0xff2b221d),
search: Color(0xff3c3129),
accent: Color(0xffe6c39e),
+ ),
+ // The light palettes mirror the dark ones' layering: the workspace gutter and
+ // tab bar sit a step darker than the terminal ground, cards a step lighter.
+ // Their accents are deep rather than pale, since an accent is drawn as text,
+ // a cursor and a focus ring on the ground.
+ paper(
+ 'Paper',
+ 'Neutral light',
+ brightness: Brightness.light,
+ foreground: Color(0xff1f1f1d),
+ background: Color(0xfffafaf9),
+ panel: Color(0xfff3f3f1),
+ card: Color(0xffffffff),
+ hover: Color(0xffebebe8),
+ workspace: Color(0xffe6e6e3),
+ tabBar: Color(0xffeeeeec),
+ search: Color(0xffe2e2df),
+ accent: Color(0xff3d5a8a),
+ ),
+ mist(
+ 'Mist',
+ 'Cool light',
+ brightness: Brightness.light,
+ foreground: Color(0xff1b2330),
+ background: Color(0xfff7f9fc),
+ panel: Color(0xffeef2f7),
+ card: Color(0xffffffff),
+ hover: Color(0xffe3e9f1),
+ workspace: Color(0xffe1e7f0),
+ tabBar: Color(0xffe9eef5),
+ search: Color(0xffdce4ee),
+ accent: Color(0xff2f5bb8),
);
const HarnessPalette(
this.label,
this.description, {
+ this.brightness = Brightness.dark,
+ this.foreground = const Color(0xfff5f5f5),
required this.background,
required this.panel,
required this.card,
@@ -90,8 +130,10 @@ enum HarnessPalette {
});
final String label, description;
+ final Brightness brightness;
+ final Color foreground;
final Color background, panel, card, hover, workspace, tabBar, search, accent;
- Color get foreground => const Color(0xfff5f5f5);
+ bool get isDark => brightness == Brightness.dark;
static HarnessPalette fromId(String? id) =>
values.where((palette) => palette.name == id).firstOrNull ?? graphite;
@@ -101,5 +143,9 @@ enum HarnessPalette {
'workspace': workspace.toARGB32(),
'search': search.toARGB32(),
'accent': accent.toARGB32(),
+ 'foreground': foreground.toARGB32(),
+ // AppKit's own surfaces (menus, the About panel, traffic lights) follow
+ // `NSApp.appearance`, which the window sets from this.
+ 'dark': isDark ? 1 : 0,
};
}
diff --git a/desktop/lib/shared/widgets/app_select_field.dart b/desktop/lib/shared/widgets/app_select_field.dart
index a53110c8e..3224a22b8 100644
--- a/desktop/lib/shared/widgets/app_select_field.dart
+++ b/desktop/lib/shared/widgets/app_select_field.dart
@@ -627,7 +627,9 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {
? widget.fillColor == null
? AppSurface.recessHover
: Color.alphaBlend(
- Colors.white.withValues(alpha: .05),
+ AppTheme.palette.value.foreground.withValues(
+ alpha: .05,
+ ),
widget.fillColor!,
)
: widget.fillColor ?? AppSurface.recess,
diff --git a/desktop/lib/sharing/share_harness_dialog.dart b/desktop/lib/sharing/share_harness_dialog.dart
index 890463f6b..871214088 100644
--- a/desktop/lib/sharing/share_harness_dialog.dart
+++ b/desktop/lib/sharing/share_harness_dialog.dart
@@ -549,7 +549,7 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {
terminalThemeStore.value,
);
final style = terminalContentStyle(color: theme.foreground);
- final muted = theme.foreground.withValues(alpha: .54);
+ final muted = theme.muted;
Widget surface(Key key, Widget child) => Material(
key: key,
color: theme.background,
diff --git a/desktop/lib/shortcuts/keyboard_practice.dart b/desktop/lib/shortcuts/keyboard_practice.dart
index 7a7c0e9e2..42e6b7d2d 100644
--- a/desktop/lib/shortcuts/keyboard_practice.dart
+++ b/desktop/lib/shortcuts/keyboard_practice.dart
@@ -8,6 +8,7 @@ import 'package:harness/terminal/terminal_text.dart';
import '../core/harness_file_store.dart';
import '../core/local_key_value_store.dart';
import '../core/test_run.dart';
+import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/app_type.dart';
import '../widgets/box_chrome.dart';
import '../widgets/terminal_prompt.dart';
@@ -579,7 +580,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
onTap: () => _open(row),
child: ColoredBox(
color: i == _cursor.clamp(0, rows.length - 1)
- ? Colors.white.withValues(alpha: .09)
+ ? boxInk(.09)
: Colors.transparent,
child: Padding(
padding: const EdgeInsets.symmetric(
@@ -675,7 +676,12 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
const SizedBox(height: 16),
Container(
padding: const EdgeInsets.all(14),
- color: Colors.black26,
+ // A recessed well: black sinks a dark field, but
+ // at 26% it turns a light one into a grey slab.
+ color: grid.AppTheme.pick(
+ boxInk(.06),
+ Colors.black26,
+ ),
child: Text(
_matched ? lesson.result : 'scratch workspace\n\n[harness 1] │ [harness 2]\n\n> ready',
key: const ValueKey('practice-preview'),
diff --git a/desktop/lib/shortcuts/keymap_settings.dart b/desktop/lib/shortcuts/keymap_settings.dart
index b99de80fd..0a8102afd 100644
--- a/desktop/lib/shortcuts/keymap_settings.dart
+++ b/desktop/lib/shortcuts/keymap_settings.dart
@@ -99,7 +99,14 @@ class KeymapSettings extends StatelessWidget {
const SizedBox(height: 8),
SelectableText(
keymap!.error!,
- style: grid.AppType.body(color: Colors.orangeAccent),
+ // Orange is error ink on a dark page only: on a light one it is
+ // under 2:1, so light takes the danger red (≥5:1).
+ style: grid.AppType.body(
+ color: grid.AppTheme.pick(
+ grid.AppPalette.dangerFill,
+ Colors.orangeAccent,
+ ),
+ ),
),
],
const SizedBox(height: 16),
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 20ab5589b..bdcb274b8 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -2398,7 +2398,7 @@ class AppNotifier extends ChangeNotifier {
/// The colours the panes are actually painted with — the terminal theme in
/// force, not the app palette by assumption (Tango is its own scheme).
static Map<String, String> terminalThemeColours() {
- final theme = terminalThemeFor(
+ final theme = terminalScreenThemeFor(
grid.AppTheme.palette.value,
terminalThemeStore.value,
);
diff --git a/desktop/lib/teams/team_workspace.dart b/desktop/lib/teams/team_workspace.dart
index 752e965b5..eb84f247c 100644
--- a/desktop/lib/teams/team_workspace.dart
+++ b/desktop/lib/teams/team_workspace.dart
@@ -1062,7 +1062,12 @@ class _TeamWorkspaceState extends State<TeamWorkspace> {
);
cell = terminalCellSizeOf(context);
foreground = theme.foreground;
- muted = foreground.withValues(alpha: .6);
+ // Read off the scheme's own ground, not the app palette's: Tango stays
+ // dark under a light palette. Near-black at .6 on a light ground is
+ // 3.9:1, so a light scheme takes .7 (≥5.4:1); a dark one keeps .6.
+ muted = foreground.withValues(
+ alpha: theme.background.computeLuminance() > .5 ? .7 : .6,
+ );
selection = theme.selection;
final title = _creating
? 'Connect a team'
diff --git a/desktop/lib/terminal/terminal_theme.dart b/desktop/lib/terminal/terminal_theme.dart
index 6fe53c39d..f1a78889d 100644
--- a/desktop/lib/terminal/terminal_theme.dart
+++ b/desktop/lib/terminal/terminal_theme.dart
@@ -10,74 +10,152 @@ import 'terminal_theme_store.dart';
/// blended toward the background at increasing strength. They are additive
/// getters, so they never change how an existing theme resolves.
extension TerminalThemeSemantics on TerminalTheme {
+ /// Dark ink on a light ground needs more of itself to stand out as far as
+ /// light ink does on a dark one, so the blends below are stronger there.
+ /// Measured on the grounds they sit on (tool/contrast.py):
+ ///
+ /// ```
+ /// graphite #181818 paper #fafaf9 mist workspace #e1e7f0
+ /// muted .54 / .70 5.51 5.97 5.4
+ /// faded .40 / .58 3.61 4.06 3.72
+ /// ```
+ bool get _lightGround => background.computeLuminance() > .5;
+
/// Low-importance text: meta, labels, timestamps, hints, secondary lines.
- Color get muted => foreground.withValues(alpha: .54);
+ Color get muted => foreground.withValues(alpha: _lightGround ? .70 : .54);
/// Lower still: disabled or strongly receding text. Kept separate from
/// [muted] so a real hierarchy has more than two levels on the same size.
- Color get faded => foreground.withValues(alpha: .40);
+ Color get faded => foreground.withValues(alpha: _lightGround ? .58 : .40);
/// The scheme's interactive accent — the cursor colour, which the match-app
/// theme sets to the app palette's accent.
Color get accent => cursor;
}
-/// The colours a terminal pane draws itself in.
+/// The colours a terminal pane's SCREEN draws itself in — the scheme the person
+/// chose, exactly. Only what paints the terminal itself reads this (the
+/// `TerminalView`, a highlight laid on it, the colours tmux is told, the
+/// scheme's own sample in Settings).
///
/// ⚠️ Returns a CACHED (or `const`) instance, never a fresh one. The vendored
/// renderer short-circuits on identity before repainting, so a new
/// [TerminalTheme] built per rebuild reads as "the colours changed" every
/// frame — the same trap [TerminalFontStore] documents for [TerminalStyle].
-TerminalTheme terminalThemeFor(
+TerminalTheme terminalScreenThemeFor(
HarnessPalette palette,
TerminalThemeChoice choice,
) => switch (choice) {
// A whole scheme of its own: the app palette is not consulted at all, which
// is the entire point of offering it.
TerminalThemeChoice.tango => tangoTerminalTheme,
+ TerminalThemeChoice.dark => darkTerminalTheme,
+ TerminalThemeChoice.light => lightTerminalTheme,
TerminalThemeChoice.matchApp => _matchApp(palette),
};
+/// The terminal-styled CHROME's colours — pickers, dialogs, headers, status
+/// lines — which are drawn on the app palette's grounds or on a ground they
+/// take from this same theme.
+///
+/// The chosen scheme while it agrees with the palette about light and dark;
+/// the palette's own match-app theme when it does not. Tango and Dark are dark
+/// schemes: under a light palette their white ink would land on the app's
+/// light grounds at about 1:1 — every header and picker unreadable — and Light
+/// under a dark palette is the same trap the other way round. The terminal
+/// screen itself still wears the chosen scheme ([terminalScreenThemeFor]).
+///
+/// Cached, like [terminalScreenThemeFor]: both return the same instances.
+TerminalTheme terminalThemeFor(
+ HarnessPalette palette,
+ TerminalThemeChoice choice,
+) {
+ final screen = terminalScreenThemeFor(palette, choice);
+ final screenDark = screen.background.computeLuminance() <= .5;
+ return screenDark == palette.isDark ? screen : _matchApp(palette);
+}
+
/// Cached per palette. Switching colors repaints the existing terminal view;
/// it does not replace its controller, buffer, input connection or font.
+///
+/// The ANSI ramp follows the palette's brightness: the dark ramp's pale yellow
+/// and white are unreadable on a light ground, and the light ramp's deep ones
+/// vanish on a dark one.
TerminalTheme _matchApp(HarnessPalette palette) => _palettes.putIfAbsent(
palette,
- () => TerminalTheme(
- cursor: palette.accent,
- selection: palette.accent.withValues(alpha: 0.3),
- foreground: palette.foreground,
- background: palette.background,
- black: darkTerminalTheme.black,
- red: darkTerminalTheme.red,
- green: darkTerminalTheme.green,
- yellow: darkTerminalTheme.yellow,
- blue: darkTerminalTheme.blue,
- magenta: darkTerminalTheme.magenta,
- cyan: darkTerminalTheme.cyan,
- white: darkTerminalTheme.white,
- brightBlack: darkTerminalTheme.brightBlack,
- brightRed: darkTerminalTheme.brightRed,
- brightGreen: darkTerminalTheme.brightGreen,
- brightYellow: darkTerminalTheme.brightYellow,
- brightBlue: darkTerminalTheme.brightBlue,
- brightMagenta: darkTerminalTheme.brightMagenta,
- brightCyan: darkTerminalTheme.brightCyan,
- brightWhite: darkTerminalTheme.brightWhite,
- searchHitBackground: darkTerminalTheme.searchHitBackground,
- searchHitBackgroundCurrent: darkTerminalTheme.searchHitBackgroundCurrent,
- searchHitForeground: darkTerminalTheme.searchHitForeground,
- ),
+ () {
+ final ramp = palette.isDark ? darkTerminalTheme : lightTerminalTheme;
+ return TerminalTheme(
+ cursor: palette.accent,
+ selection: palette.accent.withValues(alpha: 0.3),
+ foreground: palette.foreground,
+ background: palette.background,
+ black: ramp.black,
+ red: ramp.red,
+ green: ramp.green,
+ yellow: ramp.yellow,
+ blue: ramp.blue,
+ magenta: ramp.magenta,
+ cyan: ramp.cyan,
+ white: ramp.white,
+ brightBlack: ramp.brightBlack,
+ brightRed: ramp.brightRed,
+ brightGreen: ramp.brightGreen,
+ brightYellow: ramp.brightYellow,
+ brightBlue: ramp.brightBlue,
+ brightMagenta: ramp.brightMagenta,
+ brightCyan: ramp.brightCyan,
+ brightWhite: ramp.brightWhite,
+ searchHitBackground: ramp.searchHitBackground,
+ searchHitBackgroundCurrent: ramp.searchHitBackgroundCurrent,
+ searchHitForeground: ramp.searchHitForeground,
+ );
+ },
);
final _palettes = <HarnessPalette, TerminalTheme>{};
+/// The ANSI ramp a light palette's terminal uses: GitHub Light's, with the five
+/// slots it leaves under text contrast on a near-white ground darkened (same
+/// hue) until every one of the sixteen reads at ≥4.6:1 on both light palettes'
+/// grounds — white, brightBlue, brightMagenta, brightCyan and brightWhite, the
+/// last of which was 2.9:1. Any of them can be a line of an agent's output.
+/// Ground and ink come from the palette; [_matchApp] takes only the ramp and
+/// search colours.
+const lightTerminalTheme = TerminalTheme(
+ cursor: Color(0xff0969da),
+ selection: Color(0x4d0969da),
+ foreground: Color(0xff1f2328),
+ background: Color(0xffffffff),
+ black: Color(0xff24292f),
+ red: Color(0xffcf222e),
+ green: Color(0xff116329),
+ yellow: Color(0xff4d2d00),
+ blue: Color(0xff0969da),
+ magenta: Color(0xff8250df),
+ cyan: Color(0xff1b7c83),
+ white: Color(0xff5c6570),
+ brightBlack: Color(0xff57606a),
+ brightRed: Color(0xffa40e26),
+ brightGreen: Color(0xff1a7f37),
+ brightYellow: Color(0xff633c01),
+ brightBlue: Color(0xff006ce3),
+ brightMagenta: Color(0xff8749f7),
+ brightCyan: Color(0xff297a8e),
+ brightWhite: Color(0xff69737d),
+ searchHitBackground: Color(0xffffff2b),
+ searchHitBackgroundCurrent: Color(0xff31ff26),
+ searchHitForeground: Color(0xff000000),
+);
+
/// Harness owns the terminal's *default* appearance.
///
/// Terminal streams provide ANSI attributes, not the source application's
/// complete colour scheme. The default foreground, background, and ANSI ramp
-/// must therefore follow Harness's own (dark-only) appearance. Explicit ANSI
-/// and true-colour cells remain untouched by xterm, so a TUI keeps the colours
-/// it deliberately emits.
+/// must therefore follow Harness's own appearance — this ramp for a dark
+/// palette, [lightTerminalTheme]'s for a light one. Explicit ANSI and
+/// true-colour cells remain untouched by xterm, so a TUI keeps the colours it
+/// deliberately emits.
const darkTerminalTheme = TerminalTheme(
cursor: Color(0xffaeafad),
// Translucent, not opaque: this is painted over the glyphs after they're drawn (see
diff --git a/desktop/lib/terminal/terminal_theme_store.dart b/desktop/lib/terminal/terminal_theme_store.dart
index 2367ac607..785358578 100644
--- a/desktop/lib/terminal/terminal_theme_store.dart
+++ b/desktop/lib/terminal/terminal_theme_store.dart
@@ -20,9 +20,18 @@ import '../core/local_key_value_store.dart';
/// scheme later is one value here and one `const` in `terminal_theme.dart`.
enum TerminalThemeChoice {
/// Today's behaviour, and still the default: ground and cursor follow the
- /// palette chosen in Customize Harness ▸ Appearance, ANSI ramp from `darkTerminalTheme`.
+ /// palette chosen in Customize Harness ▸ Appearance, and the ANSI ramp its
+ /// brightness (`darkTerminalTheme`'s or `lightTerminalTheme`'s).
matchApp('Match app appearance', 'Matches your app palette'),
+ /// Harness's own dark screen whatever the app wears — a light app with a
+ /// dark terminal, the way many people keep an editor.
+ dark('Dark', 'A dark screen, whatever the app palette'),
+
+ /// Harness's own light screen whatever the app wears — the reverse, for
+ /// reading output on white inside a dark app.
+ light('Light', 'A light screen, whatever the app palette'),
+
/// ⚠️ Named for the PALETTE, not for the distribution that popularised it.
/// These sixteen colours are the Tango Desktop Project's, which GNOME
/// Terminal ships as its built-in `Tango` scheme. Calling it "Ubuntu" would
diff --git a/desktop/lib/viewer/qr_scanner_web.dart b/desktop/lib/viewer/qr_scanner_web.dart
index 868ebdd5e..e6cd19f7d 100644
--- a/desktop/lib/viewer/qr_scanner_web.dart
+++ b/desktop/lib/viewer/qr_scanner_web.dart
@@ -220,7 +220,7 @@ class _ScannerState extends State<_Scanner> {
child: Text(
_problem!,
textAlign: TextAlign.center,
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
)
: ClipRRect(
diff --git a/desktop/lib/widgets/add_machine_dialog.dart b/desktop/lib/widgets/add_machine_dialog.dart
index f7fd70262..e98686ece 100644
--- a/desktop/lib/widgets/add_machine_dialog.dart
+++ b/desktop/lib/widgets/add_machine_dialog.dart
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
import '../state/app_state.dart';
import '../api/api_client.dart' show MachineSignInRequest;
@@ -337,7 +338,12 @@ class _AddMachineDialogState extends State<AddMachineDialog> {
null => 'status unknown',
},
style: boxMonoStyle(
- color: online == true ? Colors.greenAccent : kBoxFaint,
+ color: online == true
+ ? grid.AppTheme.pick(
+ grid.AppPalette.online,
+ Colors.greenAccent,
+ )
+ : kBoxFaint,
),
),
if (fp != null && _phase != _Phase.failed) ...[
@@ -375,7 +381,12 @@ class _AddMachineDialogState extends State<AddMachineDialog> {
'it gets your account and your machines.'
: 'Only approve a machine you are setting up right now.',
key: const Key('add-machine-warning'),
- style: boxMonoStyle(color: Colors.amberAccent),
+ style: boxMonoStyle(
+ color: grid.AppTheme.pick(
+ grid.AppPalette.warn,
+ Colors.amberAccent,
+ ),
+ ),
),
],
const SizedBox(height: 12),
@@ -411,8 +422,11 @@ class _AddMachineDialogState extends State<AddMachineDialog> {
key: const Key('add-machine-status'),
style: boxMonoStyle(
color: _phase == _Phase.failed
- ? Colors.redAccent
- : Colors.white70,
+ ? grid.AppTheme.pick(
+ grid.AppPalette.dangerFill,
+ Colors.redAccent,
+ )
+ : boxText(.70),
),
),
const SizedBox(height: 14),
diff --git a/desktop/lib/widgets/add_phone_dialog.dart b/desktop/lib/widgets/add_phone_dialog.dart
index ac82f4187..1f29c2e28 100644
--- a/desktop/lib/widgets/add_phone_dialog.dart
+++ b/desktop/lib/widgets/add_phone_dialog.dart
@@ -651,7 +651,7 @@ class _AddPhoneDialogState extends State<AddPhoneDialog> {
TerminalTheme get _theme =>
terminalThemeFor(grid.AppTheme.palette.value, terminalThemeStore.value);
- Color get _faint => _theme.foreground.withValues(alpha: .54);
+ Color get _faint => _theme.muted;
TextStyle _ink([Color? color]) =>
terminalContentStyle(color: color ?? _theme.foreground);
diff --git a/desktop/lib/widgets/agent_picker.dart b/desktop/lib/widgets/agent_picker.dart
index 0f4b6a9cd..98a183ad6 100644
--- a/desktop/lib/widgets/agent_picker.dart
+++ b/desktop/lib/widgets/agent_picker.dart
@@ -372,7 +372,7 @@ class _AgentPickerState extends State<AgentPicker> {
style: widget.terminalStyle
? boxMonoStyle()
: grid.AppType.monoLabel(
- color: choice == null ? Colors.white60 : Colors.white,
+ color: choice == null ? boxText(.60) : boxText(1),
),
),
);
@@ -400,7 +400,7 @@ class _AgentPickerState extends State<AgentPicker> {
side: BorderSide(
color: focused && !_open
? grid.AppPalette.swarmAccent.withValues(alpha: .7)
- : Colors.white.withValues(alpha: .10),
+ : boxInk(.10),
width: focused && !_open ? 1.5 : 1,
),
),
@@ -408,7 +408,7 @@ class _AgentPickerState extends State<AgentPicker> {
child: InkWell(
canRequestFocus: false,
mouseCursor: SystemMouseCursors.click,
- hoverColor: Colors.white.withValues(alpha: .03),
+ hoverColor: boxInk(.03),
onTap: () {
_barFocus.requestFocus();
_show();
@@ -435,16 +435,16 @@ class _AgentPickerState extends State<AgentPicker> {
: Icon(
Icons.search,
size: _fontSize + 4,
- color: Colors.white60,
+ color: boxText(.60),
),
),
Expanded(child: _chosen(choice)),
- const Padding(
- padding: EdgeInsets.only(left: 12, right: 22),
+ Padding(
+ padding: const EdgeInsets.only(left: 12, right: 22),
child: Icon(
Icons.keyboard_arrow_down,
size: 22,
- color: Colors.white60,
+ color: boxText(.60),
),
),
],
@@ -622,7 +622,7 @@ class _AgentPickerState extends State<AgentPicker> {
overflow: TextOverflow.ellipsis,
style: grid.AppType.monoLabel(
fontWeight: FontWeight.w400,
- color: Colors.white60,
+ color: boxText(.60),
),
),
),
@@ -644,7 +644,7 @@ class _AgentPickerState extends State<AgentPicker> {
shadowColor: Colors.black26,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(_radius),
- side: BorderSide(color: Colors.white.withValues(alpha: .10)),
+ side: BorderSide(color: boxInk(.10)),
),
clipBehavior: Clip.antiAlias,
child: DefaultTextStyle.merge(
@@ -784,11 +784,11 @@ class _AgentPickerState extends State<AgentPicker> {
),
minTileHeight: rowHeight,
selected: highlighted,
- textColor: Colors.white,
- iconColor: Colors.white60,
- selectedColor: Colors.white,
+ textColor: boxText(1),
+ iconColor: boxText(.60),
+ selectedColor: boxText(1),
hoverColor: Colors.transparent,
- selectedTileColor: Colors.white.withValues(alpha: .055),
+ selectedTileColor: boxInk(.055),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(widget.terminalStyle ? 0 : 12),
),
@@ -818,7 +818,7 @@ class _AgentPickerState extends State<AgentPicker> {
? boxMonoStyle()
: grid.AppType.monoLabel(
fontWeight: FontWeight.w600,
- color: Colors.white,
+ color: boxText(1),
),
),
),
@@ -834,7 +834,7 @@ class _AgentPickerState extends State<AgentPicker> {
overflow: TextOverflow.ellipsis,
style: widget.terminalStyle
? boxMonoStyle(color: kBoxFaint)
- : grid.AppType.monoMeta(color: Colors.white54),
+ : grid.AppType.monoMeta(color: kBoxFaint),
),
),
],
@@ -846,8 +846,8 @@ class _AgentPickerState extends State<AgentPicker> {
choice.detail!,
matches: matches(choice.detail, title: false),
style: widget.terminalStyle
- ? boxMonoStyle(color: Colors.white60)
- : grid.AppType.monoMeta(color: Colors.white60),
+ ? boxMonoStyle(color: boxText(.60))
+ : grid.AppType.monoMeta(color: boxText(.60)),
),
trailing: widget.terminalStyle && highlighted
? Text('↵', style: boxMonoStyle(color: kBoxFaint))
@@ -864,7 +864,7 @@ class _AgentPickerState extends State<AgentPicker> {
'new-agent-${widget.label.toLowerCase()}-row-action',
),
onPressed: () => _choose(choice),
- style: TextButton.styleFrom(foregroundColor: Colors.white),
+ style: TextButton.styleFrom(foregroundColor: boxText(1)),
child: SwarmSearchActionLabel(
'${current ? 'Keep' : 'Use'} ${widget.label == 'Agent' ? 'agent' : 'harness'}',
compact: compactAction,
@@ -872,7 +872,7 @@ class _AgentPickerState extends State<AgentPicker> {
),
)
: current
- ? const Icon(Icons.check, size: 16, color: Colors.white60)
+ ? Icon(Icons.check, size: 16, color: boxText(.60))
: null,
onTap: () => _choose(choice),
),
@@ -954,11 +954,14 @@ class _AgentPreview extends StatelessWidget {
final bool terminalStyle;
static TextStyle get _muted =>
- grid.AppType.monoMeta(height: 1.5, color: Colors.white54);
+ grid.AppType.monoMeta(height: 1.5, color: kBoxFaint);
static TextStyle get _body => grid.AppType.monoLabel(
fontWeight: FontWeight.w400,
height: 1.6,
- color: Color(0xffe1e1e4),
+ color: grid.AppTheme.pick(
+ grid.AppPalette.textPrimary,
+ const Color(0xffe1e1e4),
+ ),
);
@override
@@ -993,7 +996,7 @@ class _AgentPreview extends StatelessWidget {
? boxMonoStyle()
: grid.AppType.monoLabel(
fontWeight: FontWeight.w600,
- color: Colors.white,
+ color: boxText(1),
),
),
if (choice.creator case final creator?)
@@ -1001,7 +1004,7 @@ class _AgentPreview extends StatelessWidget {
text: ' by $creator',
style: terminalStyle
? boxMonoStyle(color: kBoxFaint)
- : grid.AppType.monoMeta(color: Colors.white54),
+ : grid.AppType.monoMeta(color: kBoxFaint),
),
],
),
@@ -1016,11 +1019,11 @@ class _AgentPreview extends StatelessWidget {
Text(
detail,
style: terminalStyle
- ? boxMonoStyle(color: Colors.white70)
+ ? boxMonoStyle(color: boxText(.70))
: grid.AppType.monoLabel(
fontWeight: FontWeight.w400,
height: 1.4,
- color: Colors.white70,
+ color: boxText(.70),
),
),
],
@@ -1036,7 +1039,7 @@ class _AgentPreview extends StatelessWidget {
for (final chip in chips)
DecoratedBox(
decoration: BoxDecoration(
- color: Colors.white.withValues(alpha: .06),
+ color: boxInk(.06),
borderRadius: BorderRadius.circular(999),
),
child: Padding(
@@ -1046,7 +1049,7 @@ class _AgentPreview extends StatelessWidget {
),
child: Text(
chip,
- style: grid.AppType.monoMeta(color: Colors.white70),
+ style: grid.AppType.monoMeta(color: boxText(.70)),
),
),
),
diff --git a/desktop/lib/widgets/api_picker_form.dart b/desktop/lib/widgets/api_picker_form.dart
index 5fe366f73..edab3f786 100644
--- a/desktop/lib/widgets/api_picker_form.dart
+++ b/desktop/lib/widgets/api_picker_form.dart
@@ -430,7 +430,7 @@ class ApiPickerFormState extends State<ApiPickerForm> {
);
final style = terminalContentStyle(color: theme.foreground);
final muted = terminalContentStyle(
- color: theme.foreground.withValues(alpha: .54),
+ color: theme.muted,
);
return ListenableBuilder(
listenable: controller,
diff --git a/desktop/lib/widgets/box_chrome.dart b/desktop/lib/widgets/box_chrome.dart
index 69260b91d..89b022173 100644
--- a/desktop/lib/widgets/box_chrome.dart
+++ b/desktop/lib/widgets/box_chrome.dart
@@ -61,12 +61,32 @@ class TerminalTabBorder extends ShapeBorder {
void paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) {}
}
+/// Box ink at [alpha] for rims, hairlines and washes: white on a dark palette,
+/// the palette's own ink on a light one.
+Color boxInk(double alpha) {
+ final palette = grid.AppTheme.palette.value;
+ return palette.isDark
+ ? Colors.white.withValues(alpha: alpha)
+ : palette.foreground.withValues(alpha: alpha);
+}
+
+/// Box ink at [alpha] for text and icons. White at 54% is 5.4:1 on Graphite's
+/// workspace, but the same share of near-black is only 3.4:1 on Paper's, so a
+/// light palette never drops below 68% (4.9:1 on its darkest field).
+Color boxText(double alpha) =>
+ boxInk(grid.AppTheme.palette.value.isDark || alpha > .68 ? alpha : .68);
+
+/// Error text in a box: the pale orange reads on a dark field and vanishes on
+/// a light one.
+Color get boxErrorText =>
+ grid.AppTheme.pick(grid.AppPalette.dangerFill, Colors.orangeAccent);
+
/// Fixed UI typography for shared dialogs. Setup screens opt into the
/// terminal's size explicitly so zoom does not resize unrelated controls.
TextStyle boxMonoStyle({Color? color, FontWeight? weight, double? height}) =>
grid.AppType.mono(
height: height ?? 1.35,
- color: color ?? Colors.white,
+ color: color ?? boxText(1),
fontWeight: weight,
);
@@ -85,12 +105,10 @@ class TerminalBox extends StatelessWidget {
color: grid.AppPalette.swarmField,
surfaceTintColor: Colors.transparent,
shape: docked
- ? Border(
- top: BorderSide(color: Colors.white.withValues(alpha: .24)),
- )
+ ? Border(top: BorderSide(color: boxInk(.24)))
: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(kTerminalCornerRadius),
- side: BorderSide(color: Colors.white.withValues(alpha: .24)),
+ side: BorderSide(color: boxInk(.24)),
),
clipBehavior: Clip.antiAlias,
child: DefaultTextStyle.merge(style: boxMonoStyle(), child: child),
@@ -104,7 +122,7 @@ double boxRowHeight(TextScaler scale) =>
(scale.scale(grid.AppType.monoSize) * 1.35 + 8).clamp(26, double.infinity);
/// Key hints, shortcut glyphs and counts: the box's meta line.
-const kBoxFaint = Colors.white54;
+Color get kBoxFaint => boxText(.54);
TextStyle get kBoxFaintStyle => grid.AppType.monoMeta(color: kBoxFaint);
/// Keep the user's actual binding, printed like a terminal's local key guide.
@@ -139,9 +157,7 @@ class BoxRowHighlight extends StatelessWidget {
Widget build(BuildContext context) {
return Material(
animationDuration: Duration.zero,
- color: highlighted
- ? Colors.white.withValues(alpha: .10)
- : Colors.transparent,
+ color: highlighted ? boxInk(.10) : Colors.transparent,
borderRadius: BorderRadius.circular(terminal ? 0 : 6),
// No clip: nothing in a row overflows it, and an antialiased rounded clip
// per row was paid again on every arrow key.
@@ -233,7 +249,7 @@ class BoxHintStrip extends StatelessWidget {
maxLines: 3,
minLines: 1,
style: boxMonoStyle(
- color: isError ? Colors.orangeAccent : Colors.white70,
+ color: isError ? boxErrorText : boxText(.70),
),
),
),
@@ -271,7 +287,7 @@ class BoxHintStrip extends StatelessWidget {
children: [
TextSpan(
text: boxKeyLabel(hint.keys),
- style: const TextStyle(color: Colors.white70),
+ style: TextStyle(color: boxText(.70)),
),
TextSpan(text: ' ${hint.label}'),
],
@@ -291,7 +307,7 @@ class BoxHintStrip extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
border: Border(
- top: BorderSide(color: Colors.white.withValues(alpha: .08)),
+ top: BorderSide(color: boxInk(.08)),
),
),
child: Column(
diff --git a/desktop/lib/widgets/daemon_slot.dart b/desktop/lib/widgets/daemon_slot.dart
index 9d77d48be..921a792bd 100644
--- a/desktop/lib/widgets/daemon_slot.dart
+++ b/desktop/lib/widgets/daemon_slot.dart
@@ -25,9 +25,9 @@ TerminalTheme currentTerminalTheme() =>
debugDaemonTerminalTheme ??
terminalThemeFor(AppTheme.palette.value, terminalThemeStore.value);
-/// A terminal theme for review captures and tests. Every scheme the app
-/// ships is dark today; this is how the light-theme rules (light-safe
-/// colours, the grue's patch) are drawn and checked before one ships.
+/// A terminal theme for review captures and tests: how the light-theme rules
+/// (light-safe colours, the grue's patch) are drawn and checked without
+/// switching the app's palette.
@visibleForTesting
TerminalTheme? debugDaemonTerminalTheme;
diff --git a/desktop/lib/widgets/delete_agent_dialog.dart b/desktop/lib/widgets/delete_agent_dialog.dart
index a3a8f93ae..80bf1cf4a 100644
--- a/desktop/lib/widgets/delete_agent_dialog.dart
+++ b/desktop/lib/widgets/delete_agent_dialog.dart
@@ -177,7 +177,7 @@ class _StopAgentPromptState extends State<_StopAgentPrompt> {
widget.terminal
? 'End this shell and anything running in it? Files are kept.'
: 'Stop this harness? Project files and saved conversation history are kept.',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
const SizedBox(height: 8),
Text(
diff --git a/desktop/lib/widgets/dsh_install_panel.dart b/desktop/lib/widgets/dsh_install_panel.dart
index d47c703b9..79b59d37d 100644
--- a/desktop/lib/widgets/dsh_install_panel.dart
+++ b/desktop/lib/widgets/dsh_install_panel.dart
@@ -419,7 +419,13 @@ class _StepRow extends StatelessWidget {
color: grid.AppPalette.online,
shape: BoxShape.circle,
),
- child: const Icon(Icons.check, size: 12, color: Colors.black),
+ // Black reads on the bright dark-mode green; the deep light-mode
+ // green needs white.
+ child: Icon(
+ Icons.check,
+ size: 12,
+ color: grid.AppTheme.pick(Colors.white, Colors.black),
+ ),
),
_StepState.failed => Container(
decoration: BoxDecoration(
diff --git a/desktop/lib/widgets/engine_identity.dart b/desktop/lib/widgets/engine_identity.dart
index 852b2ef66..2396fdbaf 100644
--- a/desktop/lib/widgets/engine_identity.dart
+++ b/desktop/lib/widgets/engine_identity.dart
@@ -6,6 +6,7 @@ import 'package:harness/terminal/terminal_text.dart';
import '../core/harness_catalog.dart';
import '../core/models.dart';
+import '../shared/theme/app_theme.dart' as grid;
import '../theme/app_theme.dart';
class EngineIdentity {
@@ -938,7 +939,7 @@ class EngineMark extends StatelessWidget {
@override
Widget build(BuildContext context) {
- TerminalFontScope.watch(context);
+ final dark = grid.AppTheme.watch(context) == Brightness.dark;
final identity = engineIdentity(engine, displayName: displayName);
final mark = identity.asset != null
? Image.asset(
@@ -958,14 +959,20 @@ class EngineMark extends StatelessWidget {
? CustomPaint(
key: const ValueKey('engine-icon-claude'),
size: Size.square(size),
- painter: _ClaudeMarkPainter(identity.color),
+ // The brand clay is 2.5:1 on a light workspace; there the same
+ // hue a step deeper (3.1:1+), so the mark still reads as a shape.
+ painter: _ClaudeMarkPainter(
+ dark ? identity.color : const Color(0xffc2633f),
+ ),
)
: identity.id == kTerminalEngine
? Icon(
LucideIcons.terminal,
key: const ValueKey('engine-icon-terminal'),
size: size,
- color: identity.color,
+ // The shell's pale steel is 1.8:1 on a light workspace; there it
+ // takes the secondary ink (5.0:1).
+ color: dark ? identity.color : AppColors.mutedStrong,
)
: _InitialMark(
key: ValueKey('engine-fallback-${identity.id}'),
@@ -974,11 +981,14 @@ class EngineMark extends StatelessWidget {
);
// These vendor assets use near-white ink. Give them a stable dark ground
// so their original shapes stay visible on both light and dark surfaces.
- final needsDarkTile = const {
- 'cursor',
- 'opencode',
- 'autonomous/kicad',
- }.contains(identity.id);
+ // Grok's and Copilot's white glyphs have no ground of their own either,
+ // but sit bare on a dark palette as they always have; only a light one
+ // needs the tile.
+ final needsDarkTile =
+ const {'cursor', 'opencode', 'autonomous/kicad'}.contains(
+ identity.id,
+ ) ||
+ (!dark && const {'grok', 'copilot'}.contains(identity.id));
return Opacity(
opacity: enabled ? 1 : 0.45,
child: needsDarkTile
diff --git a/desktop/lib/widgets/fork_agent_dialog.dart b/desktop/lib/widgets/fork_agent_dialog.dart
index 02225cb25..2cad6fbb4 100644
--- a/desktop/lib/widgets/fork_agent_dialog.dart
+++ b/desktop/lib/widgets/fork_agent_dialog.dart
@@ -293,7 +293,7 @@ class _ForkAgentPromptState extends State<_ForkAgentPrompt> {
heightFactor: 1,
child: Text(
'$label >',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
),
),
@@ -385,7 +385,7 @@ class _ForkAgentPromptState extends State<_ForkAgentPrompt> {
const SizedBox(height: 8),
Text(
error,
- style: boxMonoStyle(color: Colors.orangeAccent),
+ style: boxMonoStyle(color: boxErrorText),
),
],
if (_busy)
diff --git a/desktop/lib/widgets/harness_start_page.dart b/desktop/lib/widgets/harness_start_page.dart
index 6ec3d615f..ad740797b 100644
--- a/desktop/lib/widgets/harness_start_page.dart
+++ b/desktop/lib/widgets/harness_start_page.dart
@@ -147,7 +147,7 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
shadowColor: Colors.black38,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
- side: BorderSide(color: Colors.white.withValues(alpha: .10)),
+ side: BorderSide(color: boxInk(.10)),
),
clipBehavior: Clip.antiAlias,
child: SwarmSearchKeys(
diff --git a/desktop/lib/widgets/link_another_machine_dialog.dart b/desktop/lib/widgets/link_another_machine_dialog.dart
index 5758c7eb3..21f734486 100644
--- a/desktop/lib/widgets/link_another_machine_dialog.dart
+++ b/desktop/lib/widgets/link_another_machine_dialog.dart
@@ -468,7 +468,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
focusNode: focus,
onPressed: action,
style: TextButton.styleFrom(
- foregroundColor: Colors.white70,
+ foregroundColor: boxText(.70),
textStyle: boxMonoStyle(),
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 5),
minimumSize: const Size(0, 28),
@@ -492,7 +492,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
onTap: entry.enabled ? () => unawaited(_open(entry)) : null,
child: BoxRowHighlight(
highlighted: selected,
- accent: Colors.white70,
+ accent: boxText(.70),
terminal: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
@@ -503,7 +503,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
width: 20,
child: Text(
selected ? '>' : ' ',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
),
Expanded(
@@ -572,7 +572,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
const SizedBox(height: 4),
SelectableText(
kHarnessDownloadUrl.toString(),
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
Wrap(
spacing: 8,
@@ -631,7 +631,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
children: [
Text(title, style: boxMonoStyle()),
const SizedBox(height: 4),
- SelectableText(command, style: boxMonoStyle(color: Colors.white70)),
+ SelectableText(command, style: boxMonoStyle(color: boxText(.70))),
Align(
alignment: Alignment.centerLeft,
child: _button(
@@ -723,7 +723,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {
child: Text(
'machine >',
style: boxMonoStyle(
- color: Colors.white70,
+ color: boxText(.70),
),
),
),
diff --git a/desktop/lib/widgets/link_machine_dialog.dart b/desktop/lib/widgets/link_machine_dialog.dart
index 2dcd3bbfe..9c771908e 100644
--- a/desktop/lib/widgets/link_machine_dialog.dart
+++ b/desktop/lib/widgets/link_machine_dialog.dart
@@ -461,7 +461,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
focusNode: first ? _actionFocus : null,
onPressed: action,
style: TextButton.styleFrom(
- foregroundColor: danger ? Colors.orangeAccent : Colors.white70,
+ foregroundColor: danger ? boxErrorText : boxText(.70),
textStyle: boxMonoStyle(),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
minimumSize: const Size(0, 30),
@@ -504,7 +504,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
heightFactor: 1,
child: Text(
confirm ? ' again >' : 'password >',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
),
),
@@ -565,7 +565,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
if (_editing) ...[
Text(
'Use this password on the other machine to link to this computer.',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
const SizedBox(height: 12),
_field(confirm: false),
@@ -590,14 +590,14 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
const SizedBox(height: 8),
Text(
'On the other machine: Link machine → select this computer → enter its password.',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
if (_status!.fingerprint case final fingerprint?) ...[
const SizedBox(height: 12),
Text('fingerprint', style: boxMonoStyle(color: kBoxFaint)),
SelectableText(
fingerprint,
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
],
if (_status!.setAt case final date?)
@@ -647,7 +647,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
List<Widget> _linksBody() => [
Text(
'Machines this computer can connect to.',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
const SizedBox(height: 8),
Align(
@@ -694,7 +694,7 @@ class _LinkMachineDialogState extends State<_LinkMachineDialog> {
clear
? 'Prevent new links using this password? Existing links and sessions stay connected.'
: 'Remove this computer’s saved link to ${_name(_unlinkTarget!)}? A new connection will need that machine’s password.',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
const SizedBox(height: 14),
Wrap(
diff --git a/desktop/lib/widgets/link_machine_screen.dart b/desktop/lib/widgets/link_machine_screen.dart
index 1f59845ca..d4854f4bc 100644
--- a/desktop/lib/widgets/link_machine_screen.dart
+++ b/desktop/lib/widgets/link_machine_screen.dart
@@ -243,7 +243,7 @@ class _LinkMachineScreenState extends State<LinkMachineScreen> {
const SizedBox(height: 4),
Text(
'Enter the remote password set on this machine.',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
const SizedBox(height: 14),
ReadlineKeys(
@@ -278,7 +278,7 @@ class _LinkMachineScreenState extends State<LinkMachineScreen> {
child: Text(
'password >',
style: boxMonoStyle(
- color: Colors.white70,
+ color: boxText(.70),
),
),
),
@@ -329,7 +329,7 @@ class _LinkMachineScreenState extends State<LinkMachineScreen> {
key: const Key('link-troubleshooting-details'),
style: TextButton.styleFrom(
textStyle: boxMonoStyle(),
- foregroundColor: Colors.white70,
+ foregroundColor: boxText(.70),
padding: const EdgeInsets.symmetric(
horizontal: 4,
),
diff --git a/desktop/lib/widgets/machine_actions.dart b/desktop/lib/widgets/machine_actions.dart
index 05bfa7e1c..1a6ccfffd 100644
--- a/desktop/lib/widgets/machine_actions.dart
+++ b/desktop/lib/widgets/machine_actions.dart
@@ -130,7 +130,7 @@ class _DeleteMachinePromptState extends State<_DeleteMachinePrompt> {
const SizedBox(height: 8),
Text(
'Delete this machine from your account and close its panes in this window?',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
const SizedBox(height: 12),
if (!_deleting)
diff --git a/desktop/lib/widgets/machine_picker_form.dart b/desktop/lib/widgets/machine_picker_form.dart
index 7fb83cf01..84b2ee4ed 100644
--- a/desktop/lib/widgets/machine_picker_form.dart
+++ b/desktop/lib/widgets/machine_picker_form.dart
@@ -530,7 +530,7 @@ class MachinePickerFormState extends State<MachinePickerForm> {
child: Text(
'$label >',
style: terminalContentStyle(
- color: theme.foreground.withValues(alpha: .54),
+ color: theme.muted,
),
),
),
@@ -683,7 +683,7 @@ class MachinePickerFormState extends State<MachinePickerForm> {
style: terminalContentStyle(
color: !_busy && _error
? theme.yellow
- : theme.foreground.withValues(alpha: .54),
+ : theme.muted,
),
),
),
@@ -750,7 +750,7 @@ class MachinePickerFormState extends State<MachinePickerForm> {
if (hint('picker.cancel') case final escape?) '$escape back',
].join(' · '),
style: terminalContentStyle(
- color: theme.foreground.withValues(alpha: .54),
+ color: theme.muted,
),
),
),
diff --git a/desktop/lib/widgets/machines_manager.dart b/desktop/lib/widgets/machines_manager.dart
index 08fc062ec..159c6abc2 100644
--- a/desktop/lib/widgets/machines_manager.dart
+++ b/desktop/lib/widgets/machines_manager.dart
@@ -373,7 +373,7 @@ class _MachinesManagerState extends State<_MachinesManager> {
onTap: () => unawaited(_open(entry)),
child: BoxRowHighlight(
highlighted: selected,
- accent: Colors.white70,
+ accent: boxText(.70),
terminal: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
@@ -392,8 +392,8 @@ class _MachinesManagerState extends State<_MachinesManager> {
entry.title,
style: boxMonoStyle(
color: entry.danger
- ? Colors.orangeAccent
- : Colors.white,
+ ? boxErrorText
+ : boxText(1),
weight: selected ? FontWeight.w600 : null,
),
),
@@ -500,7 +500,7 @@ class _MachinesManagerState extends State<_MachinesManager> {
heightFactor: 1,
child: Text(
_machineId == null ? 'machine >' : 'action >',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
),
),
diff --git a/desktop/lib/widgets/machines_panel.dart b/desktop/lib/widgets/machines_panel.dart
index e94449f8d..ad844634e 100644
--- a/desktop/lib/widgets/machines_panel.dart
+++ b/desktop/lib/widgets/machines_panel.dart
@@ -859,7 +859,10 @@ class _MachinesPanelState extends State<_MachinesPanel>
),
boxShadow: [
BoxShadow(
- color: Colors.black.withValues(alpha: .35),
+ // A 35% black pool is a smudge on a light palette.
+ color: Colors.black.withValues(
+ alpha: grid.AppTheme.pick(.12, .35),
+ ),
blurRadius: 36,
offset: const Offset(0, 12),
),
diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dart
index 3585c75ad..99f9ec796 100644
--- a/desktop/lib/widgets/new_agent_dialog.dart
+++ b/desktop/lib/widgets/new_agent_dialog.dart
@@ -899,7 +899,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3),
- side: BorderSide(color: Colors.white.withValues(alpha: .24)),
+ side: BorderSide(color: boxInk(.24)),
),
title: Text(_title),
titleTextStyle: boxMonoStyle(color: kBoxFaint),
@@ -1064,14 +1064,12 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
horizontal: 12,
vertical: 8,
),
- backgroundColor: Colors.white.withValues(alpha: .08),
- foregroundColor: Colors.white,
+ backgroundColor: boxInk(.08),
+ foregroundColor: boxText(1),
textStyle: boxMonoStyle(),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(2),
- side: BorderSide(
- color: Colors.white.withValues(alpha: .24),
- ),
+ side: BorderSide(color: boxInk(.24)),
),
disabledForegroundColor: _submitting
? grid.AppPalette.textPrimary
@@ -1083,11 +1081,11 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
- const SizedBox(
+ SizedBox(
width: 14,
height: 14,
child: CircularProgressIndicator(
- color: Colors.white,
+ color: boxText(1),
strokeWidth: 2,
),
),
diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dart
index ee8be1432..8900a7020 100644
--- a/desktop/lib/widgets/pane_grid.dart
+++ b/desktop/lib/widgets/pane_grid.dart
@@ -628,7 +628,7 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {
children: [
TextSpan(
text: '$key ',
- style: const TextStyle(color: Colors.white70),
+ style: TextStyle(color: boxText(.70)),
),
TextSpan(text: action),
],
@@ -1213,9 +1213,7 @@ class _PaneCell extends StatelessWidget {
// decoration present even when clear: inserting/removing it would
// reparent the terminal and lose its input, scroll and selection state.
foregroundDecoration: BoxDecoration(
- color: dimmed
- ? const Color(0xFF9D9D9D).withValues(alpha: .30)
- : null,
+ color: dimmed ? const Color(0xFF9D9D9D).withValues(alpha: .30) : null,
border: blocked
? Border.all(color: grid.AppPalette.warn, width: 2)
: null,
diff --git a/desktop/lib/widgets/prompt_context.dart b/desktop/lib/widgets/prompt_context.dart
index 6dd0c2acb..addf273b3 100644
--- a/desktop/lib/widgets/prompt_context.dart
+++ b/desktop/lib/widgets/prompt_context.dart
@@ -7,6 +7,7 @@ import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/appearance_prefs_store.dart';
import '../shared/theme/prompt_style.dart';
import '../terminal/terminal_text.dart';
+import 'box_chrome.dart';
import 'search_result_text.dart';
/// The same compact identity line in the picker, pane header and live preview.
@@ -113,7 +114,7 @@ class _PromptContextViewState extends State<PromptContextView> {
value: data.harness!,
ascii: kHarnessPromptMarker,
icon: null,
- color: Colors.white60,
+ color: boxText(.60),
),
if (data.leading?.isNotEmpty == true)
(
@@ -121,7 +122,7 @@ class _PromptContextViewState extends State<PromptContextView> {
value: data.leading!,
ascii: '',
icon: null,
- color: Colors.white60,
+ color: boxText(.60),
),
if (prefs.machine && data.machine?.isNotEmpty == true)
(
@@ -173,7 +174,7 @@ class _PromptContextViewState extends State<PromptContextView> {
final part = segments[index];
final tone =
widget.textStyle?.color ??
- (prefs.color ? part.color : Colors.white60);
+ (prefs.color ? part.color : boxText(.60));
final width = widths?[index];
final style = _style(tone);
// A folder cut short keeps both ends, the way editors
diff --git a/desktop/lib/widgets/restart_agent_action.dart b/desktop/lib/widgets/restart_agent_action.dart
index f3265300c..71085c844 100644
--- a/desktop/lib/widgets/restart_agent_action.dart
+++ b/desktop/lib/widgets/restart_agent_action.dart
@@ -226,7 +226,7 @@ class _RestartAgentPromptState extends State<_RestartAgentPrompt> {
_terminal
? 'Starts a fresh shell in the same pane.'
: 'Restarts the harness in the same pane and tries to resume its conversation.',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
if (_busy) ...[
const SizedBox(height: 8),
@@ -239,14 +239,14 @@ class _RestartAgentPromptState extends State<_RestartAgentPrompt> {
const SizedBox(height: 12),
Text(
error,
- style: boxMonoStyle(color: Colors.orangeAccent),
+ style: boxMonoStyle(color: boxErrorText),
),
],
if (_fresh) ...[
const SizedBox(height: 12),
Text(
'Started a new conversation. The previous conversation could not be resumed.',
- style: boxMonoStyle(color: Colors.orangeAccent),
+ style: boxMonoStyle(color: boxErrorText),
),
],
],
diff --git a/desktop/lib/widgets/swarm_attention.dart b/desktop/lib/widgets/swarm_attention.dart
index 80727557a..02ce3a047 100644
--- a/desktop/lib/widgets/swarm_attention.dart
+++ b/desktop/lib/widgets/swarm_attention.dart
@@ -1,6 +1,7 @@
import 'swarm_search_field.dart';
import 'package:flutter/material.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/shared/theme/app_type.dart';
import 'package:harness/terminal/terminal_text.dart';
@@ -10,6 +11,17 @@ import '../state/swarm_attention.dart';
import '../state/swarm_navigation.dart';
import 'engine_identity.dart';
+// Ink on the dialog. Dark palettes keep the white ramp it was tuned in; light
+// ones take the semantic text tokens, because black at these alphas falls
+// under 4.5:1 there.
+Color get _ink => grid.AppTheme.pick(grid.AppPalette.textPrimary, Colors.white);
+Color get _inkSoft =>
+ grid.AppTheme.pick(grid.AppPalette.textSecondary, Colors.white70);
+Color get _inkMuted =>
+ grid.AppTheme.pick(grid.AppPalette.textSecondary, Colors.white60);
+Color get _inkFaint =>
+ grid.AppTheme.pick(grid.AppPalette.textSecondary, Colors.white54);
+
Future<SwarmAttentionEntry?> showSwarmAttention(
BuildContext context,
AppNotifier app,
@@ -142,7 +154,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
const SizedBox(width: 8),
Text(
'${_catalog.length}',
- style: AppType.monoMeta(color: Colors.white54),
+ style: AppType.monoMeta(color: _inkFaint),
),
const Spacer(),
IconButton(
@@ -173,7 +185,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
_catalog.isEmpty
? 'No harnesses need your input'
: 'No matching questions',
- style: AppType.body(color: Colors.white60),
+ style: AppType.body(color: _inkMuted),
),
)
: ListView.builder(
@@ -187,8 +199,13 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
key: ValueKey(row.id),
enabled: row.available,
selected: index == _cursor,
- selectedColor: Colors.white,
- selectedTileColor: Colors.white10,
+ selectedColor: _ink,
+ selectedTileColor: grid
+ .AppTheme
+ .palette
+ .value
+ .foreground
+ .withValues(alpha: .10),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
@@ -216,7 +233,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
overflow: TextOverflow.ellipsis,
style: AppType.body(
height: 1.35,
- color: Colors.white70,
+ color: _inkSoft,
),
),
const SizedBox(height: 4),
@@ -226,7 +243,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
overflow: TextOverflow.ellipsis,
style: AppType.monoMeta(
height: 1.3,
- color: Colors.white54,
+ color: _inkFaint,
),
),
],
@@ -237,7 +254,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
: destination.hasView
? 'Jump'
: 'Open Harness',
- style: AppType.monoMeta(color: Colors.white54),
+ style: AppType.monoMeta(color: _inkFaint),
),
onTap: row.available
? () => Navigator.pop(context, row)
@@ -257,7 +274,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
: '↑↓ or ⌃N ⌃P to choose · Return to jump · Esc to close',
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: AppType.monoMeta(color: Colors.white54),
+ style: AppType.monoMeta(color: _inkFaint),
),
),
],
diff --git a/desktop/lib/widgets/swarm_dialogs.dart b/desktop/lib/widgets/swarm_dialogs.dart
index 7ce22a064..c56a21562 100644
--- a/desktop/lib/widgets/swarm_dialogs.dart
+++ b/desktop/lib/widgets/swarm_dialogs.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/shared/theme/app_type.dart';
import '../core/desktop_window.dart';
@@ -135,7 +136,12 @@ class _ProjectDialogState extends State<_ProjectDialog> {
children: [
Text(
'Choose an existing working folder.',
- style: AppType.body(color: Colors.white60),
+ style: AppType.body(
+ color: grid.AppTheme.pick(
+ grid.AppPalette.textSecondary,
+ Colors.white60,
+ ),
+ ),
),
const SizedBox(height: 20),
if (machineId != null)
@@ -172,11 +178,26 @@ class _ProjectDialogState extends State<_ProjectDialog> {
true)
TextButton(
onPressed: picking ? null : clone,
- style: TextButton.styleFrom(foregroundColor: Colors.white70),
+ style: TextButton.styleFrom(
+ foregroundColor: grid.AppTheme.pick(
+ grid.AppPalette.textSecondary,
+ Colors.white70,
+ ),
+ ),
child: const Text('Clone repository…'),
),
if (error != null)
- Text(error!, style: AppType.body(color: Colors.orangeAccent)),
+ // Pale orange only reads on a dark dialog; a light one takes
+ // the deep warning ink.
+ Text(
+ error!,
+ style: AppType.body(
+ color: grid.AppTheme.pick(
+ grid.AppPalette.warn,
+ Colors.orangeAccent,
+ ),
+ ),
+ ),
],
),
),
diff --git a/desktop/lib/widgets/swarm_resource_preview.dart b/desktop/lib/widgets/swarm_resource_preview.dart
index fde7bb28e..237fb314a 100644
--- a/desktop/lib/widgets/swarm_resource_preview.dart
+++ b/desktop/lib/widgets/swarm_resource_preview.dart
@@ -670,9 +670,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
child: Text(
hints.join(' · '),
key: const ValueKey('resource-control-hints'),
- style: terminalContentStyle(
- color: theme.foreground.withValues(alpha: .54),
- ),
+ style: terminalContentStyle(color: theme.muted),
),
);
}
@@ -1320,9 +1318,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
grid.AppTheme.palette.value,
terminalThemeStore.value,
);
- final muted = terminalContentStyle(
- color: theme.foreground.withValues(alpha: .54),
- );
+ final muted = terminalContentStyle(color: theme.muted);
return ListView(
controller: _scroll,
padding: EdgeInsets.symmetric(
@@ -1391,7 +1387,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
widget.onRefocus();
},
style: TextButton.styleFrom(
- foregroundColor: theme.foreground.withValues(alpha: .54),
+ foregroundColor: theme.muted,
textStyle: terminalContentStyle(),
padding: EdgeInsets.zero,
minimumSize: Size.zero,
@@ -1462,9 +1458,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
),
child: Text(
'Working…',
- style: terminalContentStyle(
- color: theme.foreground.withValues(alpha: .54),
- ),
+ style: terminalContentStyle(color: theme.muted),
),
),
if (_errors[row?.id] case final error?)
diff --git a/desktop/lib/widgets/swarm_search_field.dart b/desktop/lib/widgets/swarm_search_field.dart
index ec1cd9afc..35190e36a 100644
--- a/desktop/lib/widgets/swarm_search_field.dart
+++ b/desktop/lib/widgets/swarm_search_field.dart
@@ -2,8 +2,11 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:harness/terminal/terminal_text.dart';
+import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/app_type.dart';
+Color get _rim => grid.AppTheme.pick(grid.AppPalette.textFaint, Colors.white24);
+
class SwarmSearchField extends StatefulWidget {
const SwarmSearchField({
super.key,
@@ -90,21 +93,32 @@ class _SwarmSearchFieldState extends State<SwarmSearchField> {
style: AppType.mono(),
decoration: InputDecoration(
hintText: widget.hintText,
- hintStyle: AppType.mono(color: Colors.white60),
+ // Dark palettes keep the navy well this field was tuned in; on a
+ // light one it would be a dark hole under dark ink, so the field
+ // takes the search surface, a faint-ink rim and the secondary hint.
+ hintStyle: AppType.mono(
+ color: grid.AppTheme.pick(
+ grid.AppPalette.textSecondary,
+ Colors.white60,
+ ),
+ ),
prefixIcon: const Icon(Icons.search, size: 18),
filled: true,
- fillColor: const Color(0xa6111521),
+ fillColor: grid.AppTheme.pick(
+ grid.AppPalette.swarmSearchSurface,
+ const Color(0xa6111521),
+ ),
contentPadding: const EdgeInsets.symmetric(
horizontal: 14,
vertical: 14,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
- borderSide: const BorderSide(color: Colors.white24),
+ borderSide: BorderSide(color: _rim),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
- borderSide: const BorderSide(color: Colors.white24),
+ borderSide: BorderSide(color: _rim),
),
),
),
diff --git a/desktop/lib/widgets/swarm_search_input.dart b/desktop/lib/widgets/swarm_search_input.dart
index 1ad373bbd..853096a9d 100644
--- a/desktop/lib/widgets/swarm_search_input.dart
+++ b/desktop/lib/widgets/swarm_search_input.dart
@@ -105,9 +105,7 @@ class SwarmSearchInput extends StatelessWidget {
: 12,
),
),
- borderSide: outlined
- ? BorderSide(color: Colors.white.withValues(alpha: .10))
- : BorderSide.none,
+ borderSide: outlined ? BorderSide(color: boxInk(.10)) : BorderSide.none,
);
final field = TextField(
key: inputKey,
@@ -119,7 +117,7 @@ class SwarmSearchInput extends StatelessWidget {
onTapAlwaysCalled: true,
onTapOutside: onTapOutside == null ? null : (_) => onTapOutside!(),
onChanged: onChanged,
- style: terminalStyle ? style : grid.AppType.mono(color: Colors.white),
+ style: terminalStyle ? style : grid.AppType.mono(color: boxText(1)),
cursorColor: bios ? theme.cursor : grid.AppPalette.swarmAccent,
cursorWidth: cursorWidth ?? (bios ? cell.width : 2),
cursorRadius: Radius.zero,
@@ -130,9 +128,7 @@ class SwarmSearchInput extends StatelessWidget {
decoration: bios
? InputDecoration(
hintText: hint,
- hintStyle: style.copyWith(
- color: theme.foreground.withValues(alpha: .54),
- ),
+ hintStyle: style.copyWith(color: theme.muted),
hintMaxLines: 1,
isDense: true,
isCollapsed: true,
@@ -147,7 +143,7 @@ class SwarmSearchInput extends StatelessWidget {
hintText: hint,
hintStyle: terminalStyle
? style.copyWith(color: kBoxFaint)
- : grid.AppType.mono(color: Colors.white60),
+ : grid.AppType.mono(color: boxText(.60)),
hintMaxLines: 1,
prefixIcon: prompt != null
? Padding(
@@ -167,11 +163,7 @@ class SwarmSearchInput extends StatelessWidget {
)
: terminal
? null
- : Icon(
- Icons.search,
- size: fontSize + 4,
- color: Colors.white60,
- ),
+ : Icon(Icons.search, size: fontSize + 4, color: boxText(.60)),
prefixIconConstraints: BoxConstraints(
minWidth: prompt != null
? 36
@@ -191,7 +183,7 @@ class SwarmSearchInput extends StatelessWidget {
TextButton(
onPressed: onClose,
style: TextButton.styleFrom(
- foregroundColor: Colors.white60,
+ foregroundColor: boxText(.60),
minimumSize: const Size(36, 28),
),
child: Text(
diff --git a/desktop/lib/widgets/swarm_search_preview.dart b/desktop/lib/widgets/swarm_search_preview.dart
index 8fca1c121..68afc7ade 100644
--- a/desktop/lib/widgets/swarm_search_preview.dart
+++ b/desktop/lib/widgets/swarm_search_preview.dart
@@ -190,13 +190,11 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
TerminalTheme theme,
) {
final terminal = widget.terminal;
- final muted = terminal
- ? terminalContentStyle(color: theme.foreground.withValues(alpha: .54))
- : _muted;
+ final muted = terminal ? terminalContentStyle(color: theme.muted) : _muted;
final body = terminal
? terminalContentStyle(color: theme.foreground)
: _body;
- final warning = terminal ? theme.yellow : const Color(0xffe9bf79);
+ final warning = terminal ? theme.yellow : _waitingInk;
final gap = terminal ? cell.height : 12.0;
final key = _externalKey(row)!;
final tail = app.sessionTails.read(key);
@@ -307,9 +305,7 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
}
_scroll.reversed = true;
final terminal = widget.terminal;
- final muted = terminal
- ? terminalContentStyle(color: theme.foreground.withValues(alpha: .54))
- : _muted;
+ final muted = terminal ? terminalContentStyle(color: theme.muted) : _muted;
final body = terminal
? terminalContentStyle(color: theme.foreground)
: _body;
@@ -436,17 +432,13 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
if (row.detail.isNotEmpty)
Text(
row.detail,
- style: terminalContentStyle(
- color: theme.foreground.withValues(alpha: .54),
- ),
+ style: terminalContentStyle(color: theme.muted),
),
if (row.shortcut case final shortcut?) ...[
SizedBox(height: cell.height),
Text(
shortcut,
- style: terminalContentStyle(
- color: theme.foreground.withValues(alpha: .54),
- ),
+ style: terminalContentStyle(color: theme.muted),
),
],
],
@@ -495,11 +487,7 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
Text(
row.detail,
style: widget.terminal
- ? terminalContentStyle(
- color: theme.foreground.withValues(
- alpha: .54,
- ),
- )
+ ? terminalContentStyle(color: theme.muted)
: _muted,
),
// Nothing exists yet behind the create row, so
@@ -512,11 +500,7 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
child: Text(
'No recent harness text available.',
style: widget.terminal
- ? terminalContentStyle(
- color: theme.foreground.withValues(
- alpha: .54,
- ),
- )
+ ? terminalContentStyle(color: theme.muted)
: _muted,
),
),
@@ -564,12 +548,28 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
}
}
-TextStyle get _muted => AppType.monoMeta(height: 1.5, color: Colors.white54);
+TextStyle get _muted => AppType.monoMeta(height: 1.5, color: kBoxFaint);
+// Dark palettes keep the soft ink this preview was tuned in; a light one
+// takes its primary text, since #e1e1e4 vanishes on a light surface.
TextStyle get _body => AppType.monoLabel(
fontWeight: FontWeight.w400,
height: 1.6,
- color: Color(0xffe1e1e4),
+ color: grid.AppTheme.pick(
+ grid.AppPalette.textPrimary,
+ const Color(0xffe1e1e4),
+ ),
+);
+
+// The non-terminal preview's state colours. The dark ones are pale tints that
+// vanish on a light ground, where the matching status tokens take over.
+Color get _waitingInk =>
+ grid.AppTheme.pick(grid.AppPalette.warn, const Color(0xffe9bf79));
+Color get _workingInk => grid.AppTheme.pick(
+ grid.AppPalette.accentOnSurface,
+ const Color(0xffadc5eb),
);
+Color get _idleInk =>
+ grid.AppTheme.pick(grid.AppPalette.online, const Color(0xff9abea5));
/// Which part of an agent's preview to draw: all of it, or the header and the
/// footer that frame a session's latest turns ([SessionTailView]).
@@ -604,9 +604,7 @@ class _AgentPreview extends StatelessWidget {
grid.AppTheme.palette.value,
terminalThemeStore.value,
);
- final muted = terminal
- ? terminalContentStyle(color: theme.foreground.withValues(alpha: .54))
- : _muted;
+ final muted = terminal ? terminalContentStyle(color: theme.muted) : _muted;
final body = terminal
? terminalContentStyle(color: theme.foreground)
: _body;
@@ -632,14 +630,14 @@ class _AgentPreview extends StatelessWidget {
: waiting != null
? terminal
? theme.yellow
- : const Color(0xffe9bf79)
+ : _waitingInk
: working
? terminal
? theme.blue
- : const Color(0xffadc5eb)
+ : _workingInk
: terminal
? theme.green
- : const Color(0xff9abea5);
+ : _idleInk;
final project = machine.projectOf(agent);
final request =
working && record?.turnOpen == true && record?.currentRequest != null
@@ -969,9 +967,7 @@ class _Section extends StatelessWidget {
Text(
label,
style: terminal
- ? terminalContentStyle(
- color: theme.foreground.withValues(alpha: .54),
- )
+ ? terminalContentStyle(color: theme.muted)
: _muted.copyWith(fontWeight: FontWeight.w500),
),
if (!terminal) const SizedBox(height: 7),
diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dart
index b6e5951f5..d03b8de70 100644
--- a/desktop/lib/widgets/swarm_switcher.dart
+++ b/desktop/lib/widgets/swarm_switcher.dart
@@ -92,10 +92,7 @@ class _SwarmHistoryState extends State<_SwarmHistory> {
children: [
Text('History', style: grid.AppType.monoLabel()),
Spacer(),
- Text(
- 'This window',
- style: boxMonoStyle(color: Colors.white54),
- ),
+ Text('This window', style: boxMonoStyle(color: kBoxFaint)),
],
),
const SizedBox(height: 16),
@@ -816,7 +813,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
if (focused) _focusResult(row.id);
},
selected: highlighted,
- selectedColor: Colors.white,
+ selectedColor: boxText(1),
hoverColor: Colors.transparent,
// BoxRowHighlight draws the selection, the same
// in both modes of the box.
@@ -847,10 +844,10 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
row.pickerQuery != null
? const SizedBox(width: 2)
: row.isCreate
- ? const Icon(
+ ? Icon(
LucideIcons.plus300,
size: 18,
- color: Colors.white70,
+ color: boxText(.70),
)
: row.isStore
? StoreMark(size: 20, enabled: canSubmit)
@@ -862,21 +859,18 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
enabled: canSubmit,
)
: row.isProject
- ? const Icon(
+ ? Icon(
LucideIcons.folderOpen,
size: 18,
- color: Colors.white60,
+ color: boxText(.60),
)
: row.isMachine
- ? const Icon(
+ ? Icon(
LucideIcons.monitor300,
size: 18,
- color: Colors.white60,
+ color: boxText(.60),
)
- : const SwarmIcon(
- size: 20,
- color: Colors.white60,
- ),
+ : SwarmIcon(size: 20, color: boxText(.60)),
],
),
title: _SearchRowContent(
@@ -901,7 +895,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
: alreadyHere && search.placement == null
? Text(
'Already added',
- style: boxMonoStyle(color: Colors.white54),
+ style: boxMonoStyle(color: kBoxFaint),
)
: highlighted
? ConstrainedBox(
@@ -915,7 +909,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
key: const ValueKey('swarm-row-action'),
onPressed: search.canAccept ? _submit : null,
style: TextButton.styleFrom(
- foregroundColor: Colors.white,
+ foregroundColor: boxText(1),
),
child: SwarmSearchActionLabel(
search.actionLabel(row),
@@ -927,7 +921,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
? null
: Text(
row.shortcut!,
- style: boxMonoStyle(color: Colors.white60),
+ style: boxMonoStyle(color: boxText(.60)),
),
onTap: canSubmit ? () => _submit(row) : null,
);
@@ -998,14 +992,10 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
? 'No matching harnesses'
: 'No matching results',
style: widget.bios
- ? terminalContentStyle(
- color: theme.foreground.withValues(
- alpha: .54,
- ),
- )
+ ? terminalContentStyle(color: theme.muted)
: grid.AppType.monoLabel(
fontWeight: FontWeight.w400,
- color: Colors.white60,
+ color: boxText(.60),
),
),
)
@@ -1071,11 +1061,10 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
maxLines: 1,
style: widget.bios
? terminalContentStyle(
- color: theme.foreground
- .withValues(alpha: .54),
+ color: theme.muted,
)
: grid.AppType.monoLabel(
- color: Colors.white60,
+ color: boxText(.60),
),
),
),
@@ -1107,14 +1096,10 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: widget.bios
- ? terminalContentStyle(
- color: theme.foreground.withValues(
- alpha: .54,
- ),
- )
+ ? terminalContentStyle(color: theme.muted)
: grid.AppType.monoLabel(
fontWeight: FontWeight.w400,
- color: Colors.white60,
+ color: boxText(.60),
),
),
),
@@ -1150,7 +1135,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
VerticalDivider(
width: 1,
thickness: 1,
- color: (widget.bios ? theme.foreground : Colors.white)
+ color: (widget.bios ? theme.foreground : boxInk(1))
.withValues(alpha: .16),
)
else
@@ -1329,7 +1314,7 @@ class _SearchRowContentState extends State<_SearchRowContent> {
grid.AppTheme.palette.value,
terminalThemeStore.value,
);
- final muted = theme.foreground.withValues(alpha: .54);
+ final muted = theme.muted;
final modelAction = row.isModel
? widget.search.modelRowAction(row)
: null;
@@ -1452,7 +1437,11 @@ class _SearchRowContentState extends State<_SearchRowContent> {
? theme.foreground
: widget.search.modelRowLive(row) ||
status == 'Suggested'
- ? const Color(0xFF86E6A3)
+ // Pale green reads on a dark ground only; a
+ // light one takes its scheme's own green.
+ ? theme.background.computeLuminance() > .5
+ ? theme.green
+ : const Color(0xFF86E6A3)
: muted,
),
),
@@ -1543,7 +1532,7 @@ class _SearchRowContentState extends State<_SearchRowContent> {
snippet,
style: widget.terminal
? boxMonoStyle(color: kBoxFaint)
- : boxMonoStyle(color: Colors.white54),
+ : boxMonoStyle(color: kBoxFaint),
)
: widget.terminal && row.promptContext != null
? PromptContextView(
@@ -1556,15 +1545,11 @@ class _SearchRowContentState extends State<_SearchRowContent> {
iconOffset: row.detailBranchOffset ?? 0,
inlineIcon: widget.terminal || row.detailBranchOffset == null
? null
- : const Icon(
- LucideIcons.gitBranch300,
- size: 12,
- color: Colors.white60,
- ),
+ : Icon(LucideIcons.gitBranch300, size: 12, color: boxText(.60)),
matches: matches.where((match) => !match.title),
style: widget.terminal
? boxMonoStyle(color: kBoxFaint)
- : boxMonoStyle(color: Colors.white54),
+ : boxMonoStyle(color: kBoxFaint),
)
: null;
return widget.stacked
@@ -1803,7 +1788,7 @@ class SwarmSearchCount extends StatelessWidget {
key: const ValueKey('swarm-search-count'),
style: terminal
? boxMonoStyle(color: kBoxFaint)
- : boxMonoStyle(color: Colors.white54),
+ : boxMonoStyle(color: kBoxFaint),
),
);
},
diff --git a/desktop/lib/widgets/swarm_wallpaper.dart b/desktop/lib/widgets/swarm_wallpaper.dart
index 5ee168d89..fae88aa2c 100644
--- a/desktop/lib/widgets/swarm_wallpaper.dart
+++ b/desktop/lib/widgets/swarm_wallpaper.dart
@@ -154,7 +154,13 @@ class _CustomImage extends StatelessWidget {
child: Text(
'Image missing, choose again',
textAlign: TextAlign.center,
- style: grid.AppType.label(color: const Color(0xffdededb)),
+ // On the workspace grey, so a light palette needs dark ink here.
+ style: grid.AppType.label(
+ color: grid.AppTheme.pick(
+ grid.AppPalette.textSecondary,
+ const Color(0xffdededb),
+ ),
+ ),
),
);
}
diff --git a/desktop/lib/widgets/take_over_dialog.dart b/desktop/lib/widgets/take_over_dialog.dart
index 3987a52c9..4dce768b3 100644
--- a/desktop/lib/widgets/take_over_dialog.dart
+++ b/desktop/lib/widgets/take_over_dialog.dart
@@ -105,7 +105,7 @@ class _TakeOverPromptState extends State<_TakeOverPrompt> {
? '$_engineName is working on it in a terminal.'
: 'It is open in $_engineName in a terminal. '
'Moving it here quits it there.',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
const SizedBox(height: 8),
Text(
diff --git a/desktop/lib/widgets/terminal_find_bar.dart b/desktop/lib/widgets/terminal_find_bar.dart
index aba6b43fd..2bb7e8cd0 100644
--- a/desktop/lib/widgets/terminal_find_bar.dart
+++ b/desktop/lib/widgets/terminal_find_bar.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/app_type.dart';
import '../terminal/terminal_text.dart';
import '../terminal/terminal_search.dart';
@@ -174,7 +175,7 @@ class TerminalFindBarState extends State<TerminalFindBar> {
child: Row(
children: [
Expanded(
- child: Text(label, style: AppType.body(color: Colors.white)),
+ child: Text(label, style: AppType.body(color: boxText(1))),
),
const SizedBox(width: 16),
Text(hint, style: kBoxFaintStyle),
@@ -234,10 +235,10 @@ class TerminalFindBarState extends State<TerminalFindBar> {
autofocus: widget.search != null,
textAlignVertical: TextAlignVertical.center,
// The query is terminal text, so it is set like the terminal.
- style: terminalTextStyle(height: 1, color: Colors.white),
- decoration: const InputDecoration(
+ style: terminalTextStyle(height: 1, color: boxText(1)),
+ decoration: InputDecoration(
hintText: 'Find in terminal…',
- hintStyle: TextStyle(color: Colors.white54),
+ hintStyle: TextStyle(color: boxText(.54)),
isDense: true,
isCollapsed: true,
constraints: BoxConstraints(),
@@ -287,7 +288,7 @@ class TerminalFindBarState extends State<TerminalFindBar> {
padding: EdgeInsets.zero,
visualDensity: VisualDensity.compact,
iconSize: 17,
- color: selected ? Colors.white : Colors.white60,
+ color: boxText(selected ? 1 : .60),
icon: icon,
),
);
@@ -301,12 +302,12 @@ class TerminalFindBarState extends State<TerminalFindBar> {
return Row(
children: [
if (widget.readOnly) ...[
- const Tooltip(
+ Tooltip(
message: 'This terminal is read only',
child: Icon(
Icons.lock_outline,
size: 14,
- color: Colors.white54,
+ color: boxText(.54),
),
),
const SizedBox(width: 6),
@@ -316,7 +317,7 @@ class TerminalFindBarState extends State<TerminalFindBar> {
child: ExcludeSemantics(
child: Text(
'/',
- style: terminalTextStyle(color: Colors.white70),
+ style: terminalTextStyle(color: boxText(.70)),
),
),
),
@@ -341,8 +342,11 @@ class TerminalFindBarState extends State<TerminalFindBar> {
style: AppType.monoMeta(
color:
count == 0 && query.isNotEmpty && !searching
- ? const Color(0xffffb4a9)
- : Colors.white54,
+ ? grid.AppTheme.pick(
+ grid.AppPalette.dangerFill,
+ const Color(0xffffb4a9),
+ )
+ : boxText(.54),
height: 1,
),
),
@@ -364,7 +368,7 @@ class TerminalFindBarState extends State<TerminalFindBar> {
Text(
'Aa',
style: AppType.monoLabel(
- color: sensitive ? Colors.white : Colors.white54,
+ color: boxText(sensitive ? 1 : .54),
fontWeight: sensitive
? FontWeight.w700
: FontWeight.w400,
diff --git a/desktop/lib/widgets/terminal_name_prompt.dart b/desktop/lib/widgets/terminal_name_prompt.dart
index 8431d6b35..a35594b57 100644
--- a/desktop/lib/widgets/terminal_name_prompt.dart
+++ b/desktop/lib/widgets/terminal_name_prompt.dart
@@ -192,7 +192,7 @@ class _TerminalNamePromptState extends State<TerminalNamePrompt> {
heightFactor: 1,
child: Text(
'name >',
- style: boxMonoStyle(color: Colors.white70),
+ style: boxMonoStyle(color: boxText(.70)),
),
),
),
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dart
index dd8687e00..d319df0ae 100644
--- a/desktop/lib/widgets/terminal_panel.dart
+++ b/desktop/lib/widgets/terminal_panel.dart
@@ -1511,7 +1511,8 @@ class _TerminalPanelState extends State<TerminalPanel>
final p = _passage;
if (p != null && p.validate() && p.canHighlight) {
final range = p.range;
- final theme = terminalThemeFor(
+ // Laid on the screen itself, so the screen's own scheme.
+ final theme = terminalScreenThemeFor(
grid.AppTheme.palette.value,
terminalThemeStore.value,
);
@@ -2068,8 +2069,13 @@ class _TerminalPanelState extends State<TerminalPanel>
session.agentName,
maxLines: 1,
overflow: TextOverflow.ellipsis,
+ // The header's own ink, which this
+ // line stands in for while Find is open.
style: grid.AppType.monoLabel(
- color: Colors.white70,
+ color: terminalThemeFor(
+ grid.AppTheme.palette.value,
+ terminalThemeStore.value,
+ ).foreground.withValues(alpha: .70),
fontWeight: FontWeight.w400,
),
),
@@ -2145,7 +2151,7 @@ class _TerminalPanelState extends State<TerminalPanel>
focusNode: _focusNode,
autofocus: widget.focused && !showComposer,
readOnly: widget.readOnly || !session.acceptsInput,
- theme: terminalThemeFor(
+ theme: terminalScreenThemeFor(
grid.AppTheme.palette.value,
terminalThemeStore.value,
),
@@ -3345,7 +3351,10 @@ class _PaneGhost extends StatelessWidget {
border: Border.all(color: AppColors.accent, width: 1.5),
boxShadow: [
BoxShadow(
- color: Colors.black.withValues(alpha: 0.45),
+ // A lifted tile: the dark shadow would smudge a light ground.
+ color: Colors.black.withValues(
+ alpha: grid.AppTheme.pick(0.18, 0.45),
+ ),
blurRadius: 24,
offset: const Offset(0, 10),
),
diff --git a/desktop/lib/widgets/terminal_prompt.dart b/desktop/lib/widgets/terminal_prompt.dart
index 5e4f80f26..ae8776ac2 100644
--- a/desktop/lib/widgets/terminal_prompt.dart
+++ b/desktop/lib/widgets/terminal_prompt.dart
@@ -250,7 +250,7 @@ Widget terminalPromptButton(
focusNode: focusNode,
onPressed: onPressed,
style: TextButton.styleFrom(
- foregroundColor: danger ? Colors.orangeAccent : Colors.white70,
+ foregroundColor: danger ? boxErrorText : boxText(.70),
textStyle: AppType.label(),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
minimumSize: const Size(0, 30),
diff --git a/desktop/lib/widgets/workspace_welcome.dart b/desktop/lib/widgets/workspace_welcome.dart
index e22a82d62..8ec0f4686 100644
--- a/desktop/lib/widgets/workspace_welcome.dart
+++ b/desktop/lib/widgets/workspace_welcome.dart
@@ -19,6 +19,7 @@ import '../shortcuts/app_keymap.dart';
import '../shortcuts/keymap.dart';
import '../shortcuts/keymap_commands.dart';
import '../terminal/terminal_text.dart';
+import '../terminal/terminal_theme.dart' show lightTerminalTheme;
/// A quiet terminal welcome. Opening a command is always an explicit action.
///
@@ -168,8 +169,12 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {
final ink = hasArtwork
? const Color(0xffdededb)
: palette.foreground.withValues(alpha: .75);
- // The welcome surface uses a dark workspace palette in both theme modes.
- const accent = Color(0xffa5d786);
+ // Keys in the terminal's green. Artwork is dark, so over it — and on a dark
+ // palette — the pale one; on a light palette's plain field, the light
+ // terminal ramp's (5.9:1, where the pale one is 1.4:1).
+ final accent = hasArtwork || palette.isDark
+ ? const Color(0xffa5d786)
+ : lightTerminalTheme.green;
// The page stands where a terminal will, so it is set like one: the
// terminal's face at the terminal's size, following ⌘+ and ⌘−.
final style = terminalTextStyle(
@@ -485,7 +490,7 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {
style: TextButton.styleFrom(
foregroundColor: ink,
backgroundColor: selected
- ? Colors.white.withValues(alpha: .07)
+ ? ink.withValues(alpha: .07)
: Colors.transparent,
textStyle: style,
padding: const EdgeInsets.symmetric(vertical: 2),
diff --git a/desktop/macos/Runner/MainFlutterWindow.swift b/desktop/macos/Runner/MainFlutterWindow.swift
index 05f0d65b0..ac71d5f82 100644
--- a/desktop/macos/Runner/MainFlutterWindow.swift
+++ b/desktop/macos/Runner/MainFlutterWindow.swift
@@ -36,12 +36,12 @@ class MainFlutterWindow: NSWindow {
installClipboardImageChannel(messenger: flutterViewController.engine.binaryMessenger)
notifications = HarnessNotifications(messenger: flutterViewController.engine.binaryMessenger)
- // Harness Desktop is dark-only. Flutter's own theme does not reach AppKit —
- // every native surface (the standard About panel, the menu bar, the
- // window's title bar and its traffic lights, any AppKit sheet) follows
- // `NSApp.appearance`, not `MaterialApp.theme` — so it is pinned here once
- // rather than left to whatever the Mac's own Appearance setting is, which
- // would otherwise paint a dark app with a light About panel and title bar.
+ // Flutter's own theme does not reach AppKit — every native surface (the
+ // standard About panel, the menu bar, the window's title bar and its
+ // traffic lights, any AppKit sheet) follows `NSApp.appearance`, not
+ // `MaterialApp.theme`. Dark until Dart's first palette arrives (the saved
+ // one, sent before the first frame); `SwarmTabStrip.updatePalette` then
+ // follows the palette's own brightness rather than the Mac's setting.
NSApp.appearance = NSAppearance(named: .darkAqua)
installAppMenuItems()
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index 03fdd52af..e4f6b7537 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -851,6 +851,10 @@ private struct SwarmNativePalette: Equatable {
let workspace: NSColor
let search: NSColor
let accent: NSColor
+ let foreground: NSColor
+ /// A dark palette. AppKit's own surfaces follow `NSApp.appearance`, which
+ /// [SwarmTitlebarStrip.updatePalette] sets from this.
+ let dark: Bool
init(_ values: [String: Any] = [:]) {
func color(_ name: String, _ fallback: UInt32) -> NSColor {
@@ -864,6 +868,8 @@ private struct SwarmNativePalette: Equatable {
workspace = color("workspace", 0xff282828)
search = color("search", 0xff2c2c2c)
accent = color("accent", 0xffbdcbdc)
+ foreground = color("foreground", 0xfff5f5f5)
+ dark = (values["dark"] as? Int64).map { $0 != 0 } ?? true
}
}
@@ -906,12 +912,14 @@ private class SwarmIconButton: NSButton {
return true
}
override func draw(_ dirtyRect: NSRect) {
+ // `labelColor`, not white: it is white under a dark palette and black under
+ // a light one (`NSApp.appearance`, set in `updatePalette`).
if state == .on && isEnabled {
- NSColor.white.withAlphaComponent(0.08).setFill()
+ NSColor.labelColor.withAlphaComponent(0.08).setFill()
NSBezierPath(roundedRect: bounds.insetBy(dx: 1, dy: 1), xRadius: 7, yRadius: 7).fill()
}
if showsHoverFill && isEnabled && (hovered || hasKeyboardFocus || isHighlighted) {
- NSColor.white.withAlphaComponent(isHighlighted ? 0.10 : 0.05).setFill()
+ NSColor.labelColor.withAlphaComponent(isHighlighted ? 0.10 : 0.05).setFill()
NSBezierPath(roundedRect: bounds.insetBy(dx: 1, dy: 1), xRadius: 7, yRadius: 7).fill()
}
super.draw(dirtyRect)
@@ -1772,6 +1780,10 @@ private final class SwarmTabStrip: NSView {
let nextPalette = SwarmNativePalette(values)
guard nextPalette != palette else { return }
palette = nextPalette
+ // Menus, the About panel, the traffic lights and every system color below
+ // (`labelColor` in the hover wells) follow the app's appearance, not the
+ // Flutter theme, so a light palette has to say so here.
+ NSApp.appearance = NSAppearance(named: palette.dark ? .darkAqua : .aqua)
storeButton.palette = palette
newButton.contentTintColor = palette.accent
for tab in tabs { tab.palette = palette }
diff --git a/desktop/test/color_palette_test.dart b/desktop/test/color_palette_test.dart
index b367c8c14..bb9e894ff 100644
--- a/desktop/test/color_palette_test.dart
+++ b/desktop/test/color_palette_test.dart
@@ -72,7 +72,10 @@ void main() {
palette.card,
palette.workspace,
]) {
- final secondary = Color.alphaBlend(Colors.white70, background);
+ final secondary = Color.alphaBlend(
+ palette.foreground.withValues(alpha: .70),
+ background,
+ );
expect(
contrast(secondary, background),
greaterThanOrEqualTo(4.5),
@@ -92,11 +95,117 @@ void main() {
// A scheme of its own ignores the palette entirely — that is what makes
// it a scheme rather than a tint of the app's.
expect(
- terminalThemeFor(palette, TerminalThemeChoice.tango).background,
+ terminalScreenThemeFor(palette, TerminalThemeChoice.tango).background,
const Color(0xff300a24),
reason: 'Tango does not follow ${palette.name}',
);
+ // The chrome keeps Tango only where it agrees with the palette: a dark
+ // scheme's white ink on a light palette's grounds would be ~1:1.
+ expect(
+ terminalThemeFor(palette, TerminalThemeChoice.tango),
+ same(
+ palette.isDark
+ ? tangoTerminalTheme
+ : terminalThemeFor(palette, matchApp),
+ ),
+ reason: palette.name,
+ );
+ }
+ });
+
+ test('Dark and Light screens hold whatever the palette, and the chrome stays readable', () {
+ for (final palette in HarnessPalette.values) {
+ expect(
+ terminalScreenThemeFor(palette, TerminalThemeChoice.dark),
+ same(darkTerminalTheme),
+ );
+ expect(
+ terminalScreenThemeFor(palette, TerminalThemeChoice.light),
+ same(lightTerminalTheme),
+ );
+ // The scheme that disagrees with the palette keeps the screen only; the
+ // chrome drawn on the palette's grounds takes the palette's own colours.
+ final agrees = palette.isDark
+ ? TerminalThemeChoice.dark
+ : TerminalThemeChoice.light;
+ final disagrees = palette.isDark
+ ? TerminalThemeChoice.light
+ : TerminalThemeChoice.dark;
+ expect(
+ terminalThemeFor(palette, agrees),
+ same(terminalScreenThemeFor(palette, agrees)),
+ reason: palette.name,
+ );
+ expect(
+ terminalThemeFor(palette, disagrees),
+ same(terminalThemeFor(palette, TerminalThemeChoice.matchApp)),
+ reason: palette.name,
+ );
+ }
+ });
+
+ test('a light palette is light everywhere it is read', () {
+ for (final palette in [HarnessPalette.paper, HarnessPalette.mist]) {
+ expect(palette.isDark, isFalse, reason: palette.name);
+ expect(palette.nativeColors['dark'], 0, reason: palette.name);
+ final terminal = terminalThemeFor(
+ palette,
+ TerminalThemeChoice.matchApp,
+ );
+ expect(terminal.foreground, palette.foreground);
+ // The light ramp, not the dark one's pale yellow and white.
+ expect(terminal.yellow, lightTerminalTheme.yellow);
+ expect(terminal.white, lightTerminalTheme.white);
+
+ double contrast(Color a, Color b) {
+ final (x, y) = (a.computeLuminance(), b.computeLuminance());
+ return (x > y ? x + .05 : y + .05) / (x > y ? y + .05 : x + .05);
+ }
+
+ // Every ANSI slot is somebody's output text on this ground.
+ for (final slot in [
+ terminal.black, terminal.red, terminal.green, terminal.yellow,
+ terminal.blue, terminal.magenta, terminal.cyan, terminal.white,
+ terminal.brightBlack, terminal.brightRed, terminal.brightGreen,
+ terminal.brightYellow, terminal.brightBlue, terminal.brightMagenta,
+ terminal.brightCyan, terminal.brightWhite,
+ ]) {
+ expect(
+ contrast(slot, palette.background),
+ greaterThanOrEqualTo(4.5),
+ reason: '${palette.name} $slot',
+ );
+ }
+ for (final ground in [
+ palette.background,
+ palette.card,
+ palette.workspace,
+ palette.search,
+ ]) {
+ expect(
+ contrast(Color.alphaBlend(terminal.muted, ground), ground),
+ greaterThanOrEqualTo(4.5),
+ reason: '${palette.name} muted on $ground',
+ );
+ expect(
+ contrast(Color.alphaBlend(terminal.faded, ground), ground),
+ greaterThanOrEqualTo(3),
+ reason: '${palette.name} faded on $ground',
+ );
+ }
+
+ grid.AppTheme.palette.value = palette;
+ grid.AppTheme.brightness.value = palette.brightness;
+ expect(grid.AppPalette.windowBg, palette.background);
+ expect(grid.AppPalette.textPrimary.computeLuminance(), lessThan(.1));
}
+ grid.AppTheme.brightness.value = Brightness.dark;
+ expect(HarnessPalette.graphite.nativeColors['dark'], 1);
+ expect(
+ terminalThemeFor(HarnessPalette.graphite, TerminalThemeChoice.matchApp)
+ .yellow,
+ darkTerminalTheme.yellow,
+ );
});
testWidgets(