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.

Light and dark themes (Plum, Night, Cloud, Storm), plus Match macOS (#3059)

harness-for-autonomous[bot]8e3a0d95ff95
diff --git a/desktop/lib/app_shell.dart b/desktop/lib/app_shell.dart
index 3b53606ff..49a7ec509 100644
--- a/desktop/lib/app_shell.dart
+++ b/desktop/lib/app_shell.dart
@@ -101,6 +101,8 @@ Future<void> startHarness({
// Keyboard configuration has its own file and watchers. It can load beside
// the appearance, but both must be ready before the window becomes usable.
await Future.wait([loadPersistedSettings(), keymap.start()]);
+ // Match macOS repaints the app when the computer's own setting flips.
+ appearancePrefsStore.followSystemBrightness();
// Apply the saved palette to native chrome as well as the Flutter theme.
await configureDesktopWindow(palette: appearancePrefsStore.value.palette);
runApp(
diff --git a/desktop/lib/settings/appearance/palette_section.dart b/desktop/lib/settings/appearance/palette_section.dart
index b08547276..d04e04522 100644
--- a/desktop/lib/settings/appearance/palette_section.dart
+++ b/desktop/lib/settings/appearance/palette_section.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:harness/shared/theme/app_icons.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../../shared/theme/app_theme.dart' as grid;
@@ -8,6 +9,9 @@ import '../../shared/theme/appearance_prefs_store.dart';
import '../../shared/theme/color_palette.dart';
import '../../shared/widgets/section_heading.dart';
+/// Appearance ▸ Workspace's first group (task #3006): Light, Dark or Match
+/// macOS, then the light theme and the dark theme that choice shows, each
+/// chosen in its own list.
class PaletteSection extends StatelessWidget {
const PaletteSection({super.key, this.store});
final AppearancePrefsStore? store;
@@ -21,34 +25,52 @@ class PaletteSection extends StatelessWidget {
builder: (context, prefs, _) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- const SectionHeading('Color palette'),
+ const SectionHeading('Theme'),
const SizedBox(height: 12),
- LayoutBuilder(
- builder: (context, constraints) {
- final columns = constraints.maxWidth >= 660
- ? 3
- : constraints.maxWidth >= 360
- ? 2
- : 1;
- final width =
- (constraints.maxWidth - 12 * (columns - 1)) / columns;
- return Wrap(
- spacing: 12,
- runSpacing: 12,
- children: [
- for (final palette in HarnessPalette.values)
- SizedBox(
- width: width,
- child: _PaletteChoice(
- palette: palette,
- selected: prefs.palette == palette,
- onChoose: () =>
- unawaited(preferences.setPalette(palette)),
- ),
- ),
- ],
- );
- },
+ SegmentedButton<AppearanceMode>(
+ key: const ValueKey('appearance-mode'),
+ showSelectedIcon: false,
+ expandedInsets: EdgeInsets.zero,
+ style: SegmentedButton.styleFrom(
+ selectedBackgroundColor: grid.AppDesktop.selection,
+ selectedForegroundColor: grid.AppDesktop.onSelection,
+ ),
+ segments: [
+ for (final mode in AppearanceMode.values)
+ ButtonSegment(
+ value: mode,
+ label: Text(
+ mode.labelFor(defaultTargetPlatform),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ ),
+ ),
+ ],
+ selected: {prefs.mode},
+ onSelectionChanged: (selection) =>
+ unawaited(preferences.setMode(selection.first)),
+ ),
+ const SizedBox(height: 20),
+ _PaletteGroup(
+ key: const ValueKey('palettes-light'),
+ title: 'Light theme',
+ palettes: [
+ for (final palette in HarnessPalette.values)
+ if (!palette.isDark) palette,
+ ],
+ selected: prefs.lightPalette,
+ onChoose: (palette) => unawaited(preferences.setPalette(palette)),
+ ),
+ const SizedBox(height: 20),
+ _PaletteGroup(
+ key: const ValueKey('palettes-dark'),
+ title: 'Dark theme',
+ palettes: [
+ for (final palette in HarnessPalette.values)
+ if (palette.isDark) palette,
+ ],
+ selected: prefs.darkPalette,
+ onChoose: (palette) => unawaited(preferences.setPalette(palette)),
),
const SizedBox(height: 24),
],
@@ -57,6 +79,60 @@ class PaletteSection extends StatelessWidget {
}
}
+class _PaletteGroup extends StatelessWidget {
+ const _PaletteGroup({
+ super.key,
+ required this.title,
+ required this.palettes,
+ required this.selected,
+ required this.onChoose,
+ });
+ final String title;
+ final List<HarnessPalette> palettes;
+ final HarnessPalette selected;
+ final ValueChanged<HarnessPalette> onChoose;
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ title,
+ style: grid.AppType.label(color: grid.AppPalette.textSecondary),
+ ),
+ const SizedBox(height: 8),
+ LayoutBuilder(
+ builder: (context, constraints) {
+ final columns = constraints.maxWidth >= 660
+ ? 3
+ : constraints.maxWidth >= 360
+ ? 2
+ : 1;
+ final width = (constraints.maxWidth - 12 * (columns - 1)) / columns;
+ return Wrap(
+ spacing: 12,
+ runSpacing: 12,
+ children: [
+ for (final palette in palettes)
+ SizedBox(
+ width: width,
+ child: _PaletteChoice(
+ palette: palette,
+ selected: selected == palette,
+ onChoose: () => onChoose(palette),
+ ),
+ ),
+ ],
+ );
+ },
+ ),
+ ],
+ );
+ }
+}
+
class _PaletteChoice extends StatelessWidget {
const _PaletteChoice({
required this.palette,
@@ -191,6 +267,17 @@ class _WorkspacePreview extends StatelessWidget {
padding: const EdgeInsets.all(4),
child: Row(
children: [
+ // A theme's own sidebar (Plum's plum) shows in its card.
+ if (palette.sidebar != palette.workspace) ...[
+ Container(
+ width: 18,
+ decoration: BoxDecoration(
+ color: palette.sidebar,
+ borderRadius: BorderRadius.circular(3),
+ ),
+ ),
+ const SizedBox(width: 4),
+ ],
for (var pane = 0; pane < 2; pane++) ...[
if (pane > 0) const SizedBox(width: 4),
Expanded(
diff --git a/desktop/lib/settings/sections/appearance_section.dart b/desktop/lib/settings/sections/appearance_section.dart
index bf612bb14..4c3cb74fe 100644
--- a/desktop/lib/settings/sections/appearance_section.dart
+++ b/desktop/lib/settings/sections/appearance_section.dart
@@ -11,8 +11,8 @@ import '../../shared/widgets/setting_row.dart';
import '../../shortcuts/app_keymap.dart';
import '../../widgets/key_hints.dart';
-/// Appearance ▸ Workspace: inactive pane shading, automatic tab names and the
-/// colour palette. (The class keeps its old name; the tab was Appearance.)
+/// Appearance ▸ Workspace: the theme (Light / Dark / Match macOS and its two
+/// palettes), inactive pane shading and automatic tab names. (The class keeps its old name; the tab was Appearance.)
///
/// Palettes coordinate the workspace and terminal defaults. The shared font
/// and size are configured once in Appearance ▸ Terminal.
@@ -51,6 +51,8 @@ class AppearanceSection extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
+ // Light / Dark / Match macOS and the two themes first (#3006).
+ PaletteSection(store: store),
ValueListenableBuilder<AppearancePrefs>(
valueListenable: preferences,
builder: (context, prefs, _) {
@@ -189,8 +191,6 @@ class AppearanceSection extends StatelessWidget {
),
),
),
- const SizedBox(height: 24),
- PaletteSection(store: store),
// Room under the last card so a scrolled-to-bottom pane does not end
// flush against the window edge.
const SizedBox(height: 8),
diff --git a/desktop/lib/shared/theme/app_theme.dart b/desktop/lib/shared/theme/app_theme.dart
index 3f7c5ce9f..d70ec0314 100644
--- a/desktop/lib/shared/theme/app_theme.dart
+++ b/desktop/lib/shared/theme/app_theme.dart
@@ -173,6 +173,9 @@ abstract final class AppPalette {
static Color get swarmAccent => AppTheme.surfacePalette.accent;
// Shared with the native search field for a continuous input/results surface.
static Color get swarmSearchSurface => AppTheme.surfacePalette.search;
+ // The Swarm's project sidebar: the workspace color, or a palette's own
+ // (Plum's plum). Its ink is `SidebarInk`'s.
+ static Color get swarmSidebar => AppTheme.surfacePalette.sidebar;
// Getters, not consts: a light palette brings its own panel and card.
static Color get agentEntrySurface =>
AppTheme.pick(AppTheme.surfacePalette.panel, const Color(0xff101113));
@@ -383,10 +386,14 @@ abstract final class AppPalette {
static Color get onboardingTagline =>
AppTheme.pick(const Color(0xFF7D5A2C), const Color(0xFFD4A574));
+ // A palette may bring its own three grays (Plum, Night, Cloud, Storm); the
+ // rest share these ramps.
static Color get textPrimary =>
+ AppTheme.surfacePalette.text ??
AppTheme.pick(const Color(0xFF1A1A18), const Color(0xFFF5F5F5));
static Color get textSecondary =>
+ AppTheme.surfacePalette.muted ??
AppTheme.pick(const Color(0xFF62615B), const Color(0xFFA8A8A2));
/// Meta text and hints. Light is #7A7973, not the #8E8D86 it was: that one
@@ -394,12 +401,14 @@ abstract final class AppPalette {
/// (#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 => textFaintFor(isDark: AppTheme.isDark);
+ static Color get textFaint =>
+ AppTheme.surfacePalette.faint ?? textFaintFor(isDark: AppTheme.isDark);
/// [textFaint] for a theme being built, whose brightness need not be the
/// current one. Every field's placeholder is this color.
static Color textFaintFor({required bool isDark}) =>
- isDark ? const Color(0xFF6E6E68) : const Color(0xFF7A7973);
+ AppTheme.paletteFor(isDark ? Brightness.dark : Brightness.light).faint ??
+ (isDark ? const Color(0xFF6E6E68) : const Color(0xFF7A7973));
/// The page a document is drawn on, and the ink on it.
///
@@ -610,6 +619,89 @@ abstract final class AppSurface {
);
}
+/// The Swarm sidebar's ink (task #3006).
+///
+/// A theme may draw its sidebar darker than the page around it — Plum's is
+/// plum with white text in an otherwise white app. The tokens above follow
+/// one global brightness and cannot tell the sidebar from the page, so the
+/// sidebar's widgets read their ink here instead: inside [SidebarInk.scope]
+/// on such a theme they get the sidebar's own, anywhere else (the same row
+/// widgets on another page, or any theme without a sidebar of its own) the
+/// page's ordinary tokens.
+class SidebarInk extends InheritedWidget {
+ const SidebarInk._({required super.child});
+
+ /// Marks [child] as the Swarm sidebar, and gives text and icons that pick
+ /// no color of their own the sidebar's ink.
+ static Widget scope({required Widget child}) {
+ final palette = AppTheme.surfacePalette;
+ if (!palette.hasSidebarInk) return SidebarInk._(child: child);
+ return SidebarInk._(
+ child: IconTheme.merge(
+ data: IconThemeData(color: palette.sidebarInk),
+ child: DefaultTextStyle.merge(
+ style: TextStyle(color: palette.sidebarInk),
+ child: child,
+ ),
+ ),
+ );
+ }
+
+ /// The default text style of a Material drawn as the sidebar: the theme's,
+ /// in the sidebar's ink when it has its own (a Material sets its own
+ /// default style, which would hide [scope]'s).
+ static TextStyle? textStyle(BuildContext context) => switch (_own(context)) {
+ final palette? => Theme.of(
+ context,
+ ).textTheme.bodyMedium?.copyWith(color: palette.sidebarInk),
+ null => null,
+ };
+
+ static HarnessPalette? _own(BuildContext context) {
+ final palette = AppTheme.surfacePalette;
+ return palette.hasSidebarInk &&
+ context.dependOnInheritedWidgetOfExactType<SidebarInk>() != null
+ ? palette
+ : null;
+ }
+
+ /// The sidebar's inks, for code that draws only the sidebar.
+ static HarnessPalette? get _sidebarOwn =>
+ AppTheme.surfacePalette.hasSidebarInk ? AppTheme.surfacePalette : null;
+ static Color get ink => _sidebarOwn?.sidebarInk ?? AppPalette.textPrimary;
+ static Color get inkMuted => switch (_sidebarOwn) {
+ final palette? => palette.sidebarMuted ?? palette.sidebarInk!,
+ null => AppPalette.textSecondary,
+ };
+ static Color get hover => _sidebarOwn?.sidebarHover ?? AppSurface.hoverFill;
+ static Color get selected =>
+ _sidebarOwn?.sidebarSelected ?? AppSurface.selectedFill;
+
+ /// The same, for a widget that is drawn in the sidebar and elsewhere: the
+ /// sidebar's inside [scope], the page's outside it.
+ static Color foreground(BuildContext context) =>
+ _own(context)?.sidebarInk ?? AppPalette.textPrimary;
+
+ static Color muted(BuildContext context) => switch (_own(context)) {
+ final palette? => palette.sidebarMuted ?? palette.sidebarInk!,
+ null => AppPalette.textSecondary,
+ };
+
+ /// A disabled control's ink: the sidebar's own at half strength on a
+ /// sidebar with its own ink, else the page's faint.
+ static Color faint(BuildContext context) =>
+ _own(context)?.sidebarInk?.withValues(alpha: .5) ?? AppPalette.textFaint;
+
+ static Color hoverFill(BuildContext context) =>
+ _own(context)?.sidebarHover ?? AppSurface.hoverFill;
+
+ static Color selectedFill(BuildContext context) =>
+ _own(context)?.sidebarSelected ?? AppSurface.selectedFill;
+
+ @override
+ bool updateShouldNotify(SidebarInk oldWidget) => false;
+}
+
/// Translucent Codex-like chrome surfaces used behind a backdrop blur (the
/// sidebar, the top bar, floating pills). Fills are semi-transparent so the blur
/// shows through; kept separate from [AppCard] because these surfaces are chrome,
@@ -956,12 +1048,16 @@ ThemeData buildAppTheme({
onPrimary: Colors.white,
secondary: AppPalette.accent,
surface: AppTheme.paletteFor(brightness).background,
- onSurface: const Color(0xFFF5F5F5),
- onSurfaceVariant: const Color(0xFFA8A8A2),
+ onSurface:
+ AppTheme.paletteFor(brightness).text ?? const Color(0xFFF5F5F5),
+ onSurfaceVariant:
+ AppTheme.paletteFor(brightness).muted ?? const Color(0xFFA8A8A2),
surfaceContainerHighest: AppTheme.paletteFor(brightness).card,
outline: const Color(0x14FFFFFF),
outlineVariant: const Color(0x14FFFFFF),
- error: const Color(0xFFFF7068),
+ error:
+ AppTheme.paletteFor(brightness).errorInk ??
+ const Color(0xFFFF7068),
)
: ColorScheme.light(
primary: AppPalette.accent,
@@ -971,14 +1067,17 @@ ThemeData buildAppTheme({
// the dark scheme's does.
surface: AppTheme.paletteFor(brightness).background,
onSurface: AppTheme.paletteFor(brightness).foreground,
- onSurfaceVariant: const Color(0xFF62615B),
+ onSurfaceVariant:
+ AppTheme.paletteFor(brightness).muted ?? 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.paletteFor(brightness).panel,
outline: const Color(0x0F000000),
outlineVariant: const Color(0x0F000000),
- error: const Color(0xFFB3261E),
+ error:
+ AppTheme.paletteFor(brightness).errorInk ??
+ const Color(0xFFB3261E),
);
final scheme = highContrast
? baseScheme.copyWith(
diff --git a/desktop/lib/shared/theme/appearance_prefs_store.dart b/desktop/lib/shared/theme/appearance_prefs_store.dart
index aa1a8b19b..82b7d20a0 100644
--- a/desktop/lib/shared/theme/appearance_prefs_store.dart
+++ b/desktop/lib/shared/theme/appearance_prefs_store.dart
@@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
+import 'package:flutter/widgets.dart';
import 'package:path/path.dart' as p;
import '../../core/harness_file_store.dart';
@@ -131,6 +132,26 @@ class PanePrefs {
);
}
+/// Light, Dark, or whatever the computer's own setting is (task #3006).
+enum AppearanceMode {
+ light('Light'),
+ dark('Dark'),
+ system('Match macOS');
+
+ const AppearanceMode(this.label);
+ final String label;
+
+ /// What the third choice is called on this computer: the Mac's own name for
+ /// it there, the plain one elsewhere.
+ String labelFor(TargetPlatform platform) =>
+ this == system && platform != TargetPlatform.macOS
+ ? 'Match system'
+ : label;
+
+ static AppearanceMode? byId(String? id) =>
+ values.where((mode) => mode.name == id).firstOrNull;
+}
+
/// Palette, background, and prompt preferences on this computer.
/// Legacy UI font fields remain readable for older builds; current typography
/// is controlled only by TerminalFontStore.
@@ -140,6 +161,9 @@ class AppearancePrefs {
this.uiFamily,
this.uiSize = uiSizeDefault,
this.palette = HarnessPalette.graphite,
+ this.mode = AppearanceMode.dark,
+ this.lightPalette = defaultLightPalette,
+ this.darkPalette = defaultDarkPalette,
this.background = HarnessBackground.plain,
this.custom = const CustomBackground(),
this.paneOpacity = paneOpacityDefault,
@@ -149,7 +173,25 @@ class AppearancePrefs {
});
final PromptPrefs prompt;
+
+ /// The palette the app is wearing now: [lightPalette] or [darkPalette], as
+ /// [mode] and (in Match macOS) the computer's setting decide. Everything
+ /// that colors the app reads this one.
final HarnessPalette palette;
+ final AppearanceMode mode;
+
+ /// The themes Light and Dark use, each chosen on its own.
+ final HarnessPalette lightPalette, darkPalette;
+ static const defaultLightPalette = HarnessPalette.cloud;
+ static const defaultDarkPalette = HarnessPalette.graphite;
+
+ /// The palette [mode] shows when the computer is [system].
+ HarnessPalette resolve(Brightness system) => switch (mode) {
+ AppearanceMode.light => lightPalette,
+ AppearanceMode.dark => darkPalette,
+ AppearanceMode.system =>
+ system == Brightness.dark ? darkPalette : lightPalette,
+ };
final HarnessBackground background;
/// Kept while a built-in background is showing, so switching back is one
@@ -194,6 +236,9 @@ class AppearancePrefs {
String? uiFamily,
double? uiSize,
HarnessPalette? palette,
+ AppearanceMode? mode,
+ HarnessPalette? lightPalette,
+ HarnessPalette? darkPalette,
HarnessBackground? background,
CustomBackground? custom,
double? paneOpacity,
@@ -206,6 +251,9 @@ class AppearancePrefs {
uiFamily: clearUiFamily ? null : (uiFamily ?? this.uiFamily),
uiSize: uiSize ?? this.uiSize,
palette: palette ?? this.palette,
+ mode: mode ?? this.mode,
+ lightPalette: lightPalette ?? this.lightPalette,
+ darkPalette: darkPalette ?? this.darkPalette,
background: background ?? this.background,
custom: custom ?? this.custom,
paneOpacity: paneOpacity ?? this.paneOpacity,
@@ -224,6 +272,9 @@ class AppearancePrefs {
other.uiFamily == uiFamily &&
other.uiSize == uiSize &&
other.palette == palette &&
+ other.mode == mode &&
+ other.lightPalette == lightPalette &&
+ other.darkPalette == darkPalette &&
other.background == background &&
other.custom == custom &&
other.paneOpacity == paneOpacity &&
@@ -236,6 +287,9 @@ class AppearancePrefs {
uiFamily,
uiSize,
palette,
+ mode,
+ lightPalette,
+ darkPalette,
background,
custom,
paneOpacity,
@@ -252,7 +306,8 @@ class AppearancePrefs {
/// before the first frame. Not a Riverpod provider — `MaterialApp` is built
/// above every provider scope in this app, and these values have to resolve
/// before there is a scope at all.
-class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {
+class AppearancePrefsStore extends ValueNotifier<AppearancePrefs>
+ with WidgetsBindingObserver {
AppearancePrefsStore({
LocalKeyValueStore? storage,
this._backgroundsDirectory,
@@ -261,7 +316,12 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {
static const _familyKey = 'app_ui_font_family';
static const _sizeKey = 'app_ui_font_size';
+ // Holds the palette on screen at the last choice, which is all an older
+ // build reads.
static const _paletteKey = 'app_color_palette';
+ static const _modeKey = 'app_theme_mode';
+ static const _lightPaletteKey = 'app_light_palette';
+ static const _darkPaletteKey = 'app_dark_palette';
static const _backgroundKey = 'harness_start_background';
static const _customKey = 'harness_custom_background';
// Named for the retired on/off choice; it now holds only pane opacity.
@@ -282,6 +342,48 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {
final LocalKeyValueStore _storage;
final Directory? _backgroundsDirectory;
+ /// The computer's own light or dark setting, which Match macOS shows.
+ Brightness _system = _platformBrightness();
+ bool _following = false;
+ bool _disposed = false;
+
+ static Brightness _platformBrightness() {
+ try {
+ return WidgetsBinding.instance.platformDispatcher.platformBrightness;
+ } catch (_) {
+ // No binding yet (a plain unit test, or before `ensureInitialized`).
+ return PlatformDispatcher.instance.platformBrightness;
+ }
+ }
+
+ /// Follow the computer's light/dark setting from now on: in Match macOS a
+ /// change there repaints the app at once. The engine reports the system
+ /// setting itself, not the window's appearance the app sets from its
+ /// palette, so the two never chase each other. Call once the binding exists.
+ void followSystemBrightness() {
+ if (_following || _disposed) return;
+ _following = true;
+ WidgetsBinding.instance.addObserver(this);
+ _systemChanged(_platformBrightness());
+ }
+
+ @override
+ void didChangePlatformBrightness() => _systemChanged(_platformBrightness());
+
+ void _systemChanged(Brightness system) {
+ if (_disposed) return;
+ _system = system;
+ final shown = value.resolve(system);
+ if (shown != value.palette) value = value.copyWith(palette: shown);
+ }
+
+ @override
+ void dispose() {
+ _disposed = true;
+ if (_following) WidgetsBinding.instance.removeObserver(this);
+ super.dispose();
+ }
+
/// Harness's copies of custom backgrounds, beside `state.json`. Resolved on
/// first use: the browser build has no such folder and never asks for it.
Directory get backgroundsDirectory =>
@@ -305,6 +407,9 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {
_familyKey,
_sizeKey,
_paletteKey,
+ _modeKey,
+ _lightPaletteKey,
+ _darkPaletteKey,
_backgroundKey,
_customKey,
_paneOpacityKey,
@@ -315,10 +420,32 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {
]);
final custom = _customFrom(saved[_customKey]);
final background = HarnessBackground.fromId(saved[_backgroundKey]);
+ // A save from before the switch has only the palette: its brightness
+ // is the mode, and it fills that slot.
+ final shown = HarnessPalette.fromId(saved[_paletteKey]);
+ HarnessPalette slot(String key, Brightness brightness) {
+ final chosen = HarnessPalette.byId(saved[key]);
+ if (chosen?.brightness == brightness) return chosen!;
+ if (shown.brightness == brightness) return shown;
+ return brightness == Brightness.light
+ ? AppearancePrefs.defaultLightPalette
+ : AppearancePrefs.defaultDarkPalette;
+ }
+
+ final themes = AppearancePrefs(
+ mode:
+ AppearanceMode.byId(saved[_modeKey]) ??
+ (shown.isDark ? AppearanceMode.dark : AppearanceMode.light),
+ lightPalette: slot(_lightPaletteKey, Brightness.light),
+ darkPalette: slot(_darkPaletteKey, Brightness.dark),
+ );
value = AppearancePrefs(
uiFamily: _familyFrom(saved[_familyKey]),
uiSize: _sizeFrom(saved[_sizeKey]),
- palette: HarnessPalette.fromId(saved[_paletteKey]),
+ palette: themes.resolve(_system),
+ mode: themes.mode,
+ lightPalette: themes.lightPalette,
+ darkPalette: themes.darkPalette,
// Custom with no image to show is Blank, not an empty selection.
background:
background == HarnessBackground.custom && custom.image == null
@@ -344,18 +471,49 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {
/// Preview now, persist in order. Rapid choices coalesce while storage is
/// busy so an older write cannot replace the user's final selection.
+ ///
+ /// A palette fills the slot of its own brightness. In Light or Dark, one of
+ /// the other brightness also moves the mode, so the click shows; in Match
+ /// macOS the computer still decides which slot shows.
Future<void> setPalette(HarnessPalette palette) {
- if (value.palette == palette) return _paletteSave ?? Future.value();
- value = value.copyWith(palette: palette);
+ final mode = switch (value.mode) {
+ AppearanceMode.system => AppearanceMode.system,
+ _ => palette.isDark ? AppearanceMode.dark : AppearanceMode.light,
+ };
+ return _setThemes(
+ value.copyWith(
+ mode: mode,
+ lightPalette: palette.isDark ? null : palette,
+ darkPalette: palette.isDark ? palette : null,
+ ),
+ );
+ }
+
+ /// Light, Dark or Match macOS.
+ Future<void> setMode(AppearanceMode mode) =>
+ _setThemes(value.copyWith(mode: mode));
+
+ Future<void> _setThemes(AppearancePrefs next) {
+ next = next.copyWith(palette: next.resolve(_system));
+ if (next == value) return _paletteSave ?? Future.value();
+ value = next;
return _paletteSave ??= _savePalette();
}
Future<void> _savePalette() async {
try {
while (true) {
- final id = value.palette.name;
- await _storage.write(_paletteKey, id);
- if (value.palette.name == id) break;
+ final saving = value;
+ await _storage.write(_paletteKey, saving.palette.name);
+ await _storage.write(_modeKey, saving.mode.name);
+ await _storage.write(_lightPaletteKey, saving.lightPalette.name);
+ await _storage.write(_darkPaletteKey, saving.darkPalette.name);
+ if (value.palette == saving.palette &&
+ value.mode == saving.mode &&
+ value.lightPalette == saving.lightPalette &&
+ value.darkPalette == saving.darkPalette) {
+ break;
+ }
}
} catch (_) {
// The chosen palette remains usable for this run if storage fails.
@@ -613,6 +771,7 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {
/// Back to the shipped defaults.
Future<void> reset() async {
value = const AppearancePrefs();
+ _systemChanged(_system);
await _paletteSave;
await _backgroundSave;
await _customSave;
@@ -624,6 +783,9 @@ class AppearancePrefsStore extends ValueNotifier<AppearancePrefs> {
await _storage.delete(_familyKey);
await _storage.delete(_sizeKey);
await _storage.delete(_paletteKey);
+ await _storage.delete(_modeKey);
+ await _storage.delete(_lightPaletteKey);
+ await _storage.delete(_darkPaletteKey);
await _storage.delete(_backgroundKey);
await _storage.delete(_customKey);
await _storage.delete(_paneOpacityKey);
diff --git a/desktop/lib/shared/theme/color_palette.dart b/desktop/lib/shared/theme/color_palette.dart
index 59ea94b6e..4137e5c7e 100644
--- a/desktop/lib/shared/theme/color_palette.dart
+++ b/desktop/lib/shared/theme/color_palette.dart
@@ -112,6 +112,86 @@ enum HarnessPalette {
tabBar: Color(0xffe9eef5),
search: Color(0xffdce4ee),
accent: Color(0xff2f5bb8),
+ ),
+ // Task #3006 (Dee, 11-05): four neutral themes modeled on the two most used
+ // team chat apps, untinted so the text carries the page. Each brings its own
+ // three grays (text, muted for times and names, faint for hints) and one
+ // accent for links, the unread dot and buttons; red stays for counts.
+ plum(
+ 'Plum',
+ 'White with a plum sidebar',
+ brightness: Brightness.light,
+ foreground: Color(0xff1d1c1d),
+ text: Color(0xff1d1c1d),
+ muted: Color(0xff616061),
+ faint: Color(0xff686768),
+ background: Color(0xffffffff),
+ panel: Color(0xfff8f8f8),
+ card: Color(0xfff8f8f8),
+ hover: Color(0xffefefef),
+ workspace: Color(0xfff8f8f8),
+ tabBar: Color(0xfff4f4f4),
+ search: Color(0xffededed),
+ accent: Color(0xff1264a3),
+ // The one dark surface in a light theme: the Swarm sidebar, with white
+ // ink and a blue selected row.
+ sidebar: Color(0xff3f0e40),
+ sidebarInk: Color(0xffffffff),
+ sidebarMuted: Color(0xffcfc3cf),
+ sidebarHover: Color(0xff350d36),
+ sidebarSelected: Color(0xff0b4c8c),
+ sidebarOnSelected: Color(0xffffffff),
+ ),
+ night(
+ 'Night',
+ 'Near-black, untinted',
+ foreground: Color(0xffd1d2d3),
+ text: Color(0xffd1d2d3),
+ muted: Color(0xffababad),
+ faint: Color(0xff9a9b9e),
+ background: Color(0xff1a1d21),
+ panel: Color(0xff19171d),
+ card: Color(0xff222529),
+ hover: Color(0xff27292d),
+ workspace: Color(0xff19171d),
+ tabBar: Color(0xff121016),
+ search: Color(0xff222529),
+ accent: Color(0xff1d9bd1),
+ ),
+ cloud(
+ 'Cloud',
+ 'White with gray sidebars',
+ brightness: Brightness.light,
+ foreground: Color(0xff313338),
+ text: Color(0xff313338),
+ muted: Color(0xff4e5058),
+ faint: Color(0xff5c5e66),
+ background: Color(0xffffffff),
+ panel: Color(0xfff2f3f5),
+ card: Color(0xffebedef),
+ hover: Color(0xffe3e5e8),
+ workspace: Color(0xfff2f3f5),
+ tabBar: Color(0xffe3e5e8),
+ search: Color(0xffffffff),
+ accent: Color(0xff4752c4),
+ ),
+ storm(
+ 'Storm',
+ 'Soft gray with a darker rail',
+ foreground: Color(0xffdbdee1),
+ text: Color(0xffdbdee1),
+ muted: Color(0xffb5bac1),
+ faint: Color(0xffa3a9b1),
+ background: Color(0xff313338),
+ panel: Color(0xff2b2d31),
+ card: Color(0xff383a40),
+ hover: Color(0xff35373c),
+ workspace: Color(0xff2b2d31),
+ tabBar: Color(0xff1e1f22),
+ search: Color(0xff2b2d31),
+ accent: Color(0xff949cf7),
+ // The shared dark red (#FF7068) is 4.2:1 on Storm's lighter field.
+ errorInk: Color(0xffff8f8a),
);
const HarnessPalette(
@@ -127,16 +207,56 @@ enum HarnessPalette {
required this.tabBar,
required this.search,
required this.accent,
+ this.text,
+ this.muted,
+ this.faint,
+ this.errorInk,
+ this._sidebar,
+ this.sidebarInk,
+ this.sidebarMuted,
+ this._sidebarHover,
+ this._sidebarSelected,
+ this._sidebarOnSelected,
});
final String label, description;
final Brightness brightness;
final Color foreground;
final Color background, panel, card, hover, workspace, tabBar, search, accent;
+
+ /// The palette's own text, muted and faint inks. Null keeps the app's
+ /// shared ramp for this brightness (`AppPalette.textPrimary` and the rest),
+ /// which is what every palette before these four uses.
+ final Color? text, muted, faint;
+
+ /// Error ink, where the shared one for this brightness is too dim on the
+ /// palette's grounds.
+ final Color? errorInk;
+
+ final Color? _sidebar, _sidebarHover, _sidebarSelected, _sidebarOnSelected;
+
+ /// The Swarm sidebar's ground: the workspace color unless the palette gives
+ /// the sidebar one of its own.
+ Color get sidebar => _sidebar ?? workspace;
+
+ /// Ink for a sidebar that is darker than the theme around it (Plum). Null
+ /// means the sidebar uses the page's ink.
+ final Color? sidebarInk, sidebarMuted;
+
+ /// Whether the Swarm sidebar wears its own ink rather than the page's.
+ bool get hasSidebarInk => sidebarInk != null;
+
+ Color get sidebarHover => _sidebarHover ?? hover;
+ Color get sidebarSelected => _sidebarSelected ?? hover;
+ Color get sidebarOnSelected =>
+ _sidebarOnSelected ?? sidebarInk ?? text ?? foreground;
bool get isDark => brightness == Brightness.dark;
- static HarnessPalette fromId(String? id) =>
- values.where((palette) => palette.name == id).firstOrNull ?? graphite;
+ static HarnessPalette fromId(String? id) => byId(id) ?? graphite;
+
+ /// The palette saved under [id], or null for an unknown or missing one.
+ static HarnessPalette? byId(String? id) =>
+ values.where((palette) => palette.name == id).firstOrNull;
Map<String, int> get nativeColors => {
'tabBar': tabBar.toARGB32(),
diff --git a/desktop/lib/shared/widgets/app_icon_button.dart b/desktop/lib/shared/widgets/app_icon_button.dart
index 3991a7912..9d0ed819d 100644
--- a/desktop/lib/shared/widgets/app_icon_button.dart
+++ b/desktop/lib/shared/widgets/app_icon_button.dart
@@ -154,9 +154,12 @@ class _AppIconButtonState extends State<AppIconButton>
final enabled = widget.onPressed != null && !widget.spinning;
final highContrast = MediaQuery.highContrastOf(context);
final reduceMotion = MediaQuery.disableAnimationsOf(context);
+ // In a sidebar with its own ink (Plum), that ink; elsewhere the page's.
final resting =
widget.color ??
- (highContrast ? AppPalette.textPrimary : AppPalette.textSecondary);
+ (highContrast
+ ? SidebarInk.foreground(context)
+ : SidebarInk.muted(context));
// Only the glyph changes. The fill stays the same neutral lift every other
// button gets, so a destructive button reads as *the same affordance* the
// rest of the app uses — just saying, in its ink, what it would do.
@@ -166,7 +169,8 @@ class _AppIconButtonState extends State<AppIconButton>
);
final active = widget.destructive
? danger
- : (widget.hoverColor ?? AppPalette.textPrimary);
+ : (widget.hoverColor ?? SidebarInk.foreground(context));
+ final hoverFill = widget.hoverFill ?? SidebarInk.hoverFill(context);
return Semantics(
value: widget.spinning ? 'Working' : null,
@@ -203,7 +207,7 @@ class _AppIconButtonState extends State<AppIconButton>
foregroundColor: WidgetStateProperty.resolveWith((states) {
if (widget.spinning && widget.onPressed != null) return resting;
if (states.contains(WidgetState.disabled)) {
- return AppPalette.textFaint;
+ return SidebarInk.faint(context);
}
return states.contains(WidgetState.hovered) ||
states.contains(WidgetState.pressed) ||
@@ -213,7 +217,7 @@ class _AppIconButtonState extends State<AppIconButton>
}),
backgroundColor: WidgetStatePropertyAll(
widget.selected == true
- ? AppSurface.selectedFill
+ ? SidebarInk.selectedFill(context)
: Colors.transparent,
),
overlayColor: WidgetStateProperty.resolveWith((states) {
@@ -223,12 +227,12 @@ class _AppIconButtonState extends State<AppIconButton>
if (states.contains(WidgetState.pressed)) {
return Color.alphaBlend(
AppPalette.textPrimary.withValues(alpha: .08),
- widget.hoverFill ?? AppSurface.hoverFill,
+ hoverFill,
);
}
if (states.contains(WidgetState.hovered) ||
states.contains(WidgetState.focused)) {
- return widget.hoverFill ?? AppSurface.hoverFill;
+ return hoverFill;
}
return Colors.transparent;
}),
diff --git a/desktop/lib/super_tabs/buddy_rows.dart b/desktop/lib/super_tabs/buddy_rows.dart
index 233d26021..40f78851d 100644
--- a/desktop/lib/super_tabs/buddy_rows.dart
+++ b/desktop/lib/super_tabs/buddy_rows.dart
@@ -89,12 +89,14 @@ class SuperTabBuddyRow extends StatelessWidget {
Widget build(BuildContext context) {
// Muted when read, full strength when unread or open (Dee, 10-31).
final color = onTap != null && (selected || unread)
- ? DesktopChrome.foreground
- : DesktopChrome.muted;
+ ? grid.SidebarInk.foreground(context)
+ : grid.SidebarInk.muted(context);
return Padding(
padding: const EdgeInsets.only(bottom: grid.AppDesktop.listRowGap),
child: Material(
- color: selected ? grid.AppSurface.selectedFill : Colors.transparent,
+ color: selected
+ ? grid.SidebarInk.selectedFill(context)
+ : Colors.transparent,
borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
clipBehavior: Clip.antiAlias,
child: Semantics(
@@ -102,8 +104,8 @@ class SuperTabBuddyRow extends StatelessWidget {
selected: selected,
child: InkWell(
onTap: onTap,
- hoverColor: grid.AppSurface.hoverFill,
- focusColor: grid.AppSurface.hoverFill,
+ hoverColor: grid.SidebarInk.hoverFill(context),
+ focusColor: grid.SidebarInk.hoverFill(context),
borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
child: Tooltip(
message: tooltip,
@@ -159,7 +161,9 @@ class SuperTabBuddyRow extends StatelessWidget {
'($project)',
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(),
+ style: DesktopChrome.metadata(
+ color: grid.SidebarInk.muted(context),
+ ),
),
),
],
@@ -171,7 +175,9 @@ class SuperTabBuddyRow extends StatelessWidget {
note,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(),
+ style: DesktopChrome.metadata(
+ color: grid.SidebarInk.muted(context),
+ ),
),
),
],
@@ -189,7 +195,9 @@ class SuperTabBuddyRow extends StatelessWidget {
detail,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(),
+ style: DesktopChrome.metadata(
+ color: grid.SidebarInk.muted(context),
+ ),
),
),
],
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index 21bb2868f..493f69cb1 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -123,7 +123,7 @@ class ProjectSidebar extends StatelessWidget {
? null
: SwarmType.sidebar(
compact: false,
- color: DesktopChrome.muted,
+ color: grid.SidebarInk.inkMuted,
medium: true,
);
@@ -139,7 +139,7 @@ class ProjectSidebar extends StatelessWidget {
}) => Padding(
padding: const EdgeInsets.only(bottom: 2),
child: Material(
- color: selected ? grid.AppSurface.selectedFill : Colors.transparent,
+ color: selected ? grid.SidebarInk.selected : Colors.transparent,
borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
clipBehavior: Clip.antiAlias,
child: Semantics(
@@ -148,8 +148,8 @@ class ProjectSidebar extends StatelessWidget {
child: InkWell(
key: ValueKey(key),
onTap: onTap,
- hoverColor: grid.AppSurface.hoverFill,
- focusColor: grid.AppSurface.hoverFill,
+ hoverColor: grid.SidebarInk.hover,
+ focusColor: grid.SidebarInk.hover,
borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
child: Row(
children: [
@@ -160,8 +160,8 @@ class ProjectSidebar extends StatelessWidget {
icon,
size: AppIcons.inlineSize,
color: onTap == null
- ? DesktopChrome.muted
- : DesktopChrome.foreground,
+ ? grid.SidebarInk.inkMuted
+ : grid.SidebarInk.ink,
),
),
Expanded(
@@ -189,8 +189,8 @@ class ProjectSidebar extends StatelessWidget {
medium: selected,
color:
onTap == null || (unread == false && !selected)
- ? DesktopChrome.muted
- : DesktopChrome.foreground,
+ ? grid.SidebarInk.inkMuted
+ : grid.SidebarInk.ink,
).copyWith(
fontWeight: unread == true
? grid.AppFont.semibold
@@ -226,7 +226,7 @@ class ProjectSidebar extends StatelessWidget {
'$count',
style: SwarmType.sidebar(
compact: compact,
- color: DesktopChrome.foreground,
+ color: grid.SidebarInk.ink,
).copyWith(fontWeight: grid.AppFont.semibold),
)
: null,
@@ -254,13 +254,13 @@ class ProjectSidebar extends StatelessWidget {
/// A project reads as a channel; a private one keeps its lock in this mark slot.
Widget _channelMark({required bool isPrivate}) => isPrivate
- ? PrivateProjectLock(size: 14, color: DesktopChrome.muted)
+ ? PrivateProjectLock(size: 14, color: grid.SidebarInk.inkMuted)
: Text(
'#',
textAlign: TextAlign.center,
style: SwarmType.sidebar(
compact: compact,
- color: DesktopChrome.muted,
+ color: grid.SidebarInk.inkMuted,
medium: true,
),
);
@@ -341,8 +341,8 @@ class ProjectSidebar extends StatelessWidget {
final style = SwarmType.sidebar(
compact: compact,
color: highlighted || (unread && !muted)
- ? DesktopChrome.foreground
- : DesktopChrome.muted,
+ ? grid.SidebarInk.ink
+ : grid.SidebarInk.inkMuted,
).copyWith(fontWeight: unread && !muted ? grid.AppFont.semibold : null);
return Padding(
padding: const EdgeInsets.only(bottom: 2),
@@ -359,7 +359,7 @@ class ProjectSidebar extends StatelessWidget {
key: ValueKey(key ?? 'super-group-${group.id}'),
onTap: !tappable ? null : onTap ?? () => onSelect(group.id),
hoverColor: Colors.transparent,
- focusColor: grid.AppSurface.hoverFill,
+ focusColor: grid.SidebarInk.hover,
borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
child: Row(
children: [
@@ -372,7 +372,7 @@ class ProjectSidebar extends StatelessWidget {
? Icon(
AppIcons.bot,
size: AppIcons.inlineSize,
- color: DesktopChrome.foreground,
+ color: grid.SidebarInk.ink,
)
: null,
),
@@ -468,7 +468,7 @@ class ProjectSidebar extends StatelessWidget {
'super-muted-${group.id}',
),
size: 14,
- color: DesktopChrome.muted,
+ color: grid.SidebarInk.inkMuted,
),
),
],
@@ -658,26 +658,29 @@ class ProjectSidebar extends StatelessWidget {
),
]..sort((a, b) => a.$1.toLowerCase().compareTo(b.$1.toLowerCase()));
+ // The sidebar's ink scope (#3006): a theme's own sidebar ink reaches the
+ // shared rows drawn in it.
@override
- Widget build(BuildContext context) => switch ([
- ?attention,
- ?activity,
- ?places,
- ]) {
- final List<Listenable> sources when sources.isNotEmpty => ListenableBuilder(
- listenable: Listenable.merge(sources),
- builder: (context, _) => _build(context),
- ),
- _ => _build(context),
- };
+ Widget build(BuildContext context) => grid.SidebarInk.scope(
+ child: switch ([?attention, ?activity, ?places]) {
+ final List<Listenable> sources when sources.isNotEmpty =>
+ ListenableBuilder(
+ listenable: Listenable.merge(sources),
+ builder: (context, _) => _build(context),
+ ),
+ _ => Builder(builder: _build),
+ },
+ );
Widget _build(BuildContext context) {
final snapshot = controller.snapshot;
final projects = snapshot?.projects ?? const <SuperTabProject>[];
final reading = _SidebarReading(controller, attention);
return Material(
- // The page's color: the rule at its edge is what separates them.
- color: grid.AppPalette.swarmWelcome,
+ // The page's color: the rule at its edge is what separates them. A
+ // theme may give the sidebar its own (Plum's plum).
+ color: grid.AppPalette.swarmSidebar,
+ textStyle: grid.SidebarInk.textStyle(context),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -829,9 +832,9 @@ class _RowSurfaceState extends State<_RowSurface> {
onExit: (_) => setState(() => _hovered = false),
child: Material(
color: widget.selected
- ? grid.AppSurface.selectedFill
+ ? grid.SidebarInk.selected
: _hovered
- ? grid.AppSurface.hoverFill
+ ? grid.SidebarInk.hover
: Colors.transparent,
borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
clipBehavior: Clip.antiAlias,
diff --git a/desktop/lib/super_tabs/section_heading.dart b/desktop/lib/super_tabs/section_heading.dart
index 89a1a7548..228dde29d 100644
--- a/desktop/lib/super_tabs/section_heading.dart
+++ b/desktop/lib/super_tabs/section_heading.dart
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
+import '../shared/theme/app_theme.dart' as grid;
+
import '../shared/theme/app_icons.dart';
import '../shared/widgets/app_icon_button.dart';
import '../widgets/desktop_chrome.dart';
@@ -162,7 +164,7 @@ class SuperTabSectionHeading extends StatelessWidget {
? AppIcons.chevronRight
: AppIcons.chevronDown,
size: AppIcons.inlineSize,
- color: DesktopChrome.muted,
+ color: grid.SidebarInk.muted(context),
),
],
),
diff --git a/desktop/lib/super_tabs/swarm_switcher.dart b/desktop/lib/super_tabs/swarm_switcher.dart
index b8fe5a6c6..f22f96393 100644
--- a/desktop/lib/super_tabs/swarm_switcher.dart
+++ b/desktop/lib/super_tabs/swarm_switcher.dart
@@ -506,7 +506,7 @@ class _SwarmSwitcherState extends State<SwarmSwitcher> {
trailing: Icon(
AppIcons.chevronDown,
size: 14,
- color: DesktopChrome.muted,
+ color: grid.SidebarInk.muted(context),
),
),
),
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 9f95da7b9..e094d5568 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -5629,7 +5629,7 @@ class _SuperTabViewState extends State<SuperTabView>
child: SizedBox(
width: 240,
child: Material(
- color: grid.AppPalette.swarmWelcome,
+ color: grid.AppPalette.swarmSidebar,
elevation: 8,
child: _sidebar(),
),
diff --git a/desktop/test/color_palette_test.dart b/desktop/test/color_palette_test.dart
index c1ec2cbd9..86bfb6eed 100644
--- a/desktop/test/color_palette_test.dart
+++ b/desktop/test/color_palette_test.dart
@@ -239,11 +239,13 @@ void main() {
),
);
expect(tester.takeException(), isNull);
- await tester.sendKeyEvent(LogicalKeyboardKey.tab);
- await tester.sendKeyEvent(LogicalKeyboardKey.tab);
+ // Light, Dark and Match first; then the light themes, Paper and Mist.
+ for (var i = 0; i < 5; i++) {
+ await tester.sendKeyEvent(LogicalKeyboardKey.tab);
+ }
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
- expect(store.value.palette, HarnessPalette.dusk);
+ expect(store.value.palette, HarnessPalette.mist);
await tester.ensureVisible(find.byKey(const ValueKey('palette-forest')));
expect(
tester
diff --git a/desktop/test/harness_customize_test.dart b/desktop/test/harness_customize_test.dart
index 1bbbdf1c0..08a4663ab 100644
--- a/desktop/test/harness_customize_test.dart
+++ b/desktop/test/harness_customize_test.dart
@@ -172,13 +172,13 @@ void main() {
.data,
];
expect(tabs, ['Status', 'Workspace', 'Wallpaper', 'Terminal']);
- // Workspace: the panes' shading, the tabs' names and the colour palette.
+ // Workspace: the theme, the panes' shading and the tabs' names.
await tester.tap(find.byKey(const ValueKey('customize-appearance')));
await tester.pumpAndSettle();
expect(find.text('Fade inactive panes'), findsOneWidget);
expect(find.text('Pane style'), findsOneWidget);
expect(find.text('Auto rename'), findsOneWidget);
- expect(find.text('Color palette'), findsOneWidget);
+ expect(find.text('Theme'), findsOneWidget);
expect(tester.takeException(), isNull);
},
);
@@ -772,7 +772,7 @@ void main() {
}
await tester.tap(find.byKey(const ValueKey('customize-appearance')));
await tester.pumpAndSettle();
- expect(find.text('Color palette'), findsOneWidget);
+ expect(find.text('Theme'), findsOneWidget);
expect(find.byKey(const ValueKey('palette-graphite')), findsOneWidget);
expect(find.byKey(const Key('appearance-ui-size-field')), findsNothing);
expect(tester.takeException(), isNull);
diff --git a/desktop/test/startup_test.dart b/desktop/test/startup_test.dart
index 8a09c98d7..b1dccc775 100644
--- a/desktop/test/startup_test.dart
+++ b/desktop/test/startup_test.dart
@@ -113,6 +113,7 @@ void main() {
uiFamily: 'Helvetica Neue',
uiSize: 16,
palette: HarnessPalette.forest,
+ darkPalette: HarnessPalette.forest,
),
);
expect(nextStats.summary.agentsSpawned, 1);
@@ -177,6 +178,9 @@ void main() {
'app_ui_font_family',
'app_ui_font_size',
'app_color_palette',
+ 'app_theme_mode',
+ 'app_light_palette',
+ 'app_dark_palette',
'harness_start_background',
'harness_custom_background',
'harness_background_behind_harnesses',
diff --git a/desktop/test/theme_mode_appearance_test.dart b/desktop/test/theme_mode_appearance_test.dart
new file mode 100644
index 000000000..f783e36df
--- /dev/null
+++ b/desktop/test/theme_mode_appearance_test.dart
@@ -0,0 +1,213 @@
+// Task #3006 (Dee, 11-05): Light / Dark / Match macOS at the top of
+// Appearance > Workspace, with the light and the dark theme chosen below it,
+// and the whole app following the Mac live in Match macOS.
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/app_shell.dart';
+import 'package:harness/core/local_key_value_store.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/shared/theme/appearance_prefs_store.dart';
+import 'package:harness/shared/theme/color_palette.dart';
+import 'package:harness/state/app_state.dart';
+import 'package:harness/widgets/harness_customize_pane.dart';
+
+import 'swarm_state_test.dart' show createApp;
+
+class _Storage implements LocalKeyValueStore {
+ final values = <String, String>{};
+ @override
+ Future<String?> read(String key) async => values[key];
+ @override
+ Future<void> delete(String key) async => values.remove(key);
+ @override
+ Future<void> write(String key, String value) async => values[key] = value;
+}
+
+Future<void> _openWorkspace(
+ WidgetTester tester,
+ AppearancePrefsStore store,
+) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = const Size(1000, 1400);
+ addTearDown(tester.view.reset);
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: store.value.palette.brightness),
+ home: Scaffold(
+ body: Align(
+ alignment: Alignment.centerRight,
+ child: SizedBox(
+ width: 440,
+ child: HarnessCustomizePane(onClose: () {}, store: store),
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.tap(find.byKey(const ValueKey('customize-appearance')));
+ await tester.pumpAndSettle();
+}
+
+Iterable<String> _palettesIn(String group) => find
+ .descendant(
+ of: find.byKey(ValueKey(group)),
+ matching: find.byWidgetPredicate(
+ (widget) =>
+ widget.key is ValueKey<String> &&
+ (widget.key! as ValueKey<String>).value.startsWith('palette-'),
+ ),
+ )
+ .evaluate()
+ .map((e) => (e.widget.key! as ValueKey<String>).value.substring(8));
+
+void main() {
+ tearDown(() {
+ grid.AppTheme.palette.value = HarnessPalette.graphite;
+ grid.AppTheme.brightness.value = Brightness.dark;
+ });
+
+ testWidgets('Workspace opens on Light / Dark / Match macOS, themes below', (
+ tester,
+ ) async {
+ final store = AppearancePrefsStore(storage: _Storage());
+ addTearDown(store.dispose);
+ await _openWorkspace(tester, store);
+
+ final mode = find.byKey(const ValueKey('appearance-mode'));
+ expect(mode, findsOneWidget);
+ for (final label in ['Light', 'Dark', 'Match macOS']) {
+ expect(
+ find.descendant(of: mode, matching: find.text(label)),
+ findsOneWidget,
+ );
+ }
+ // At the top: above the light themes, the dark themes and every pane row.
+ final top = tester.getTopLeft(mode).dy;
+ expect(
+ top,
+ lessThan(
+ tester.getTopLeft(find.byKey(const ValueKey('palettes-light'))).dy,
+ ),
+ );
+ expect(
+ tester.getTopLeft(find.byKey(const ValueKey('palettes-light'))).dy,
+ lessThan(
+ tester.getTopLeft(find.byKey(const ValueKey('palettes-dark'))).dy,
+ ),
+ );
+ expect(top, lessThan(tester.getTopLeft(find.text('Pane style')).dy));
+
+ expect(_palettesIn('palettes-light').toSet(), {
+ for (final p in HarnessPalette.values)
+ if (!p.isDark) p.name,
+ });
+ expect(_palettesIn('palettes-dark').toSet(), {
+ for (final p in HarnessPalette.values)
+ if (p.isDark) p.name,
+ });
+ expect(tester.takeException(), isNull);
+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
+
+ testWidgets('elsewhere the third choice is Match system', (tester) async {
+ final store = AppearancePrefsStore(storage: _Storage());
+ addTearDown(store.dispose);
+ await _openWorkspace(tester, store);
+ expect(find.text('Match system'), findsOneWidget);
+ expect(find.text('Match macOS'), findsNothing);
+ }, variant: TargetPlatformVariant.only(TargetPlatform.linux));
+
+ testWidgets('the switch and the two theme lists set what shows', (
+ tester,
+ ) async {
+ final store = AppearancePrefsStore(storage: _Storage());
+ addTearDown(store.dispose);
+ await _openWorkspace(tester, store);
+ final mode = find.byKey(const ValueKey('appearance-mode'));
+
+ await tester.tap(find.descendant(of: mode, matching: find.text('Light')));
+ await tester.pumpAndSettle();
+ expect(store.value.mode, AppearanceMode.light);
+ expect(store.value.palette, HarnessPalette.cloud);
+
+ await tester.ensureVisible(find.byKey(const ValueKey('palette-plum')));
+ await tester.tap(find.byKey(const ValueKey('palette-plum')));
+ await tester.pumpAndSettle();
+ expect(store.value.palette, HarnessPalette.plum);
+
+ await tester.ensureVisible(find.byKey(const ValueKey('palette-night')));
+ await tester.tap(find.byKey(const ValueKey('palette-night')));
+ await tester.pumpAndSettle();
+ expect(store.value.mode, AppearanceMode.dark);
+ expect(store.value.palette, HarnessPalette.night);
+ expect(store.value.lightPalette, HarnessPalette.plum);
+
+ await tester.ensureVisible(mode);
+ await tester.tap(find.descendant(of: mode, matching: find.text('Light')));
+ await tester.pumpAndSettle();
+ expect(store.value.palette, HarnessPalette.plum);
+
+ // Each list marks its own choice, whichever one is on screen.
+ expect(
+ tester.getSemantics(find.byKey(const ValueKey('palette-night'))),
+ isSemantics(isSelected: true),
+ );
+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
+
+ testWidgets('in Match macOS the whole app follows the Mac live', (
+ tester,
+ ) async {
+ final dispatcher = tester.platformDispatcher;
+ dispatcher.platformBrightnessTestValue = Brightness.light;
+ addTearDown(dispatcher.clearPlatformBrightnessTestValue);
+ final saved = appearancePrefsStore.value;
+ addTearDown(() => appearancePrefsStore.value = saved);
+ appearancePrefsStore.value = const AppearancePrefs();
+ appearancePrefsStore.followSystemBrightness();
+ final app = createApp()..status = AppStatus.authenticated;
+ addTearDown(app.dispose);
+ late BuildContext screen;
+ await tester.pumpWidget(
+ ProviderScope(
+ overrides: [appStateProvider.overrideWithValue(app)],
+ child: HarnessApp(
+ authenticatedScreen: (_) => Builder(
+ builder: (context) {
+ screen = context;
+ return Scaffold(
+ body: TextButton(
+ onPressed: () => unawaited(showHarnessCustomizePane(context)),
+ child: const Text('Open Appearance'),
+ ),
+ );
+ },
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ await tester.tap(find.text('Open Appearance'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.byKey(const ValueKey('customize-appearance')));
+ await tester.pumpAndSettle();
+ await tester.tap(find.text('Match macOS'));
+ await tester.pumpAndSettle();
+ expect(appearancePrefsStore.value.mode, AppearanceMode.system);
+ expect(grid.AppTheme.palette.value, HarnessPalette.cloud);
+ expect(Theme.of(screen).brightness, Brightness.light);
+
+ dispatcher.platformBrightnessTestValue = Brightness.dark;
+ await tester.pumpAndSettle();
+ expect(grid.AppTheme.palette.value, HarnessPalette.graphite);
+ expect(grid.AppTheme.brightness.value, Brightness.dark);
+ expect(Theme.of(screen).brightness, Brightness.dark);
+
+ dispatcher.platformBrightnessTestValue = Brightness.light;
+ await tester.pumpAndSettle();
+ expect(grid.AppTheme.palette.value, HarnessPalette.cloud);
+ expect(Theme.of(screen).brightness, Brightness.light);
+ await tester.pumpWidget(const SizedBox());
+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
+}
diff --git a/desktop/test/theme_mode_test.dart b/desktop/test/theme_mode_test.dart
new file mode 100644
index 000000000..7021f6e56
--- /dev/null
+++ b/desktop/test/theme_mode_test.dart
@@ -0,0 +1,185 @@
+// Task #3006 (Dee, 11-05): Light / Dark / Match macOS, each with the light and
+// the dark theme it uses chosen separately. Match macOS follows the system
+// setting live.
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/local_key_value_store.dart';
+import 'package:harness/shared/theme/appearance_prefs_store.dart';
+import 'package:harness/shared/theme/color_palette.dart';
+
+class _Storage implements LocalKeyValueStore {
+ final values = <String, String>{};
+ Completer<void>? gate;
+ @override
+ Future<String?> read(String key) async => values[key];
+ @override
+ Future<void> delete(String key) async => values.remove(key);
+ @override
+ Future<void> write(String key, String value) async {
+ await gate?.future;
+ values[key] = value;
+ }
+}
+
+void main() {
+ test('someone who never opens Appearance keeps Graphite, in Dark', () async {
+ const prefs = AppearancePrefs();
+ expect(prefs.mode, AppearanceMode.dark);
+ expect(prefs.palette, HarnessPalette.graphite);
+ expect(prefs.darkPalette, HarnessPalette.graphite);
+ expect(prefs.lightPalette, HarnessPalette.cloud);
+ final store = AppearancePrefsStore(storage: _Storage());
+ addTearDown(store.dispose);
+ await store.load();
+ expect(store.value, const AppearancePrefs());
+ });
+
+ test('Light and Dark each show their own chosen theme', () async {
+ final store = AppearancePrefsStore(storage: _Storage());
+ addTearDown(store.dispose);
+ await store.setMode(AppearanceMode.light);
+ expect(store.value.palette, HarnessPalette.cloud);
+ await store.setPalette(HarnessPalette.plum);
+ expect(store.value.palette, HarnessPalette.plum);
+ expect(store.value.lightPalette, HarnessPalette.plum);
+ await store.setMode(AppearanceMode.dark);
+ expect(store.value.palette, HarnessPalette.graphite);
+ // Choosing a dark theme in Light moves to Dark; the light choice stays.
+ await store.setMode(AppearanceMode.light);
+ await store.setPalette(HarnessPalette.storm);
+ expect(store.value.mode, AppearanceMode.dark);
+ expect(store.value.palette, HarnessPalette.storm);
+ expect(store.value.lightPalette, HarnessPalette.plum);
+ await store.setPalette(HarnessPalette.paper);
+ expect(store.value.mode, AppearanceMode.light);
+ expect(store.value.palette, HarnessPalette.paper);
+ expect(store.value.darkPalette, HarnessPalette.storm);
+ });
+
+ testWidgets('Match macOS follows the system setting live, and only then', (
+ tester,
+ ) async {
+ final dispatcher = tester.platformDispatcher;
+ dispatcher.platformBrightnessTestValue = Brightness.light;
+ addTearDown(dispatcher.clearPlatformBrightnessTestValue);
+ final store = AppearancePrefsStore(storage: _Storage());
+ addTearDown(store.dispose);
+ store.followSystemBrightness();
+ await store.setPalette(HarnessPalette.plum);
+ await store.setPalette(HarnessPalette.night);
+ await store.setMode(AppearanceMode.system);
+ expect(store.value.palette, HarnessPalette.plum);
+
+ dispatcher.platformBrightnessTestValue = Brightness.dark;
+ expect(store.value.palette, HarnessPalette.night);
+ dispatcher.platformBrightnessTestValue = Brightness.light;
+ expect(store.value.palette, HarnessPalette.plum);
+
+ // In Match, choosing a theme only sets its slot: the Mac decides which.
+ await store.setPalette(HarnessPalette.storm);
+ expect(store.value.mode, AppearanceMode.system);
+ expect(store.value.palette, HarnessPalette.plum);
+ dispatcher.platformBrightnessTestValue = Brightness.dark;
+ expect(store.value.palette, HarnessPalette.storm);
+
+ // Out of Match, a system flip changes nothing.
+ await store.setMode(AppearanceMode.light);
+ dispatcher.platformBrightnessTestValue = Brightness.light;
+ dispatcher.platformBrightnessTestValue = Brightness.dark;
+ expect(store.value.palette, HarnessPalette.plum);
+ });
+
+ testWidgets('a closed store stops following the system', (tester) async {
+ final dispatcher = tester.platformDispatcher;
+ addTearDown(dispatcher.clearPlatformBrightnessTestValue);
+ final store = AppearancePrefsStore(storage: _Storage());
+ store.followSystemBrightness();
+ store.followSystemBrightness(); // Once is enough; twice is harmless.
+ await store.setMode(AppearanceMode.system);
+ store.dispose();
+ dispatcher.platformBrightnessTestValue = Brightness.dark;
+ dispatcher.platformBrightnessTestValue = Brightness.light;
+ expect(tester.takeException(), isNull);
+ });
+
+ test(
+ 'choices survive a relaunch, and the old key keeps what shows',
+ () async {
+ final storage = _Storage()..gate = Completer<void>();
+ final store = AppearancePrefsStore(storage: storage);
+ addTearDown(store.dispose);
+ final saving = store.setPalette(HarnessPalette.plum);
+ store.setPalette(HarnessPalette.storm);
+ store.setMode(AppearanceMode.system);
+ store.setMode(AppearanceMode.light);
+ storage.gate!.complete();
+ await saving;
+ await Future<void>.delayed(Duration.zero);
+ final reopened = AppearancePrefsStore(storage: storage);
+ addTearDown(reopened.dispose);
+ await reopened.load();
+ expect(reopened.value.mode, AppearanceMode.light);
+ expect(reopened.value.lightPalette, HarnessPalette.plum);
+ expect(reopened.value.darkPalette, HarnessPalette.storm);
+ expect(reopened.value.palette, HarnessPalette.plum);
+ // An older build reads only this key: it opens in the same look.
+ expect(storage.values['app_color_palette'], 'plum');
+ await reopened.reset();
+ expect(storage.values.keys, isNot(contains('app_theme_mode')));
+ expect(storage.values.keys, isNot(contains('app_light_palette')));
+ expect(storage.values.keys, isNot(contains('app_dark_palette')));
+ expect(reopened.value, const AppearancePrefs());
+ },
+ );
+
+ test('a save from before the switch keeps its look', () async {
+ for (final (saved, mode, light, dark) in [
+ (
+ 'paper',
+ AppearanceMode.light,
+ HarnessPalette.paper,
+ HarnessPalette.graphite,
+ ),
+ (
+ 'mist',
+ AppearanceMode.light,
+ HarnessPalette.mist,
+ HarnessPalette.graphite,
+ ),
+ (
+ 'forest',
+ AppearanceMode.dark,
+ HarnessPalette.cloud,
+ HarnessPalette.forest,
+ ),
+ ]) {
+ final storage = _Storage()..values['app_color_palette'] = saved;
+ final store = AppearancePrefsStore(storage: storage);
+ addTearDown(store.dispose);
+ await store.load();
+ expect(store.value.mode, mode, reason: saved);
+ expect(store.value.lightPalette, light, reason: saved);
+ expect(store.value.darkPalette, dark, reason: saved);
+ expect(store.value.palette.name, saved);
+ }
+ });
+
+ test('hand-edited choices land on usable themes', () async {
+ final storage = _Storage()
+ ..values.addAll({
+ 'app_theme_mode': 'sepia',
+ 'app_light_palette': 'graphite', // a dark theme in the light slot
+ 'app_dark_palette': 'nonsense',
+ 'app_color_palette': 'storm',
+ });
+ final store = AppearancePrefsStore(storage: storage);
+ addTearDown(store.dispose);
+ await store.load();
+ expect(store.value.mode, AppearanceMode.dark);
+ expect(store.value.lightPalette, HarnessPalette.cloud);
+ expect(store.value.darkPalette, HarnessPalette.storm);
+ expect(store.value.palette, HarnessPalette.storm);
+ });
+}
diff --git a/desktop/test/theme_palettes_shots_test.dart b/desktop/test/theme_palettes_shots_test.dart
new file mode 100644
index 000000000..dfd648823
--- /dev/null
+++ b/desktop/test/theme_palettes_shots_test.dart
@@ -0,0 +1,246 @@
+// Task #3006 (Dee, 11-05): the Swarm in each new theme, for the pictures Dee
+// okays before it merges: the chat with its sidebar, a thread open beside it,
+// and Activity with a decision waiting. Writes nothing unless THEME_SHOTS
+// names a folder.
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/core/local_key_value_store.dart';
+import 'package:harness/shared/theme/appearance_prefs_store.dart';
+import 'package:harness/shared/theme/color_palette.dart';
+import 'package:harness/super_tabs/activity.dart';
+import 'package:harness/super_tabs/attention.dart';
+import 'package:harness/super_tabs/view.dart';
+import 'package:harness/widgets/harness_customize_pane.dart';
+
+import 'support/capture.dart';
+import 'support/super_tab_fixture.dart';
+import 'swarm_state_test.dart' show createApp;
+
+final shots = Platform.environment['THEME_SHOTS'];
+
+ConversationServer _swarm() {
+ final server = ConversationServer()
+ ..threads = true
+ ..followedThreads = {'unread': [], 'read': [], 'more': false};
+ server.state['projects'] = [
+ projectFixture('lead', 'openharness', 'lead'),
+ projectFixture('web', 'website', 'web-lead'),
+ ];
+ final groups = server.state['conversations'] as List;
+ groups
+ ..add({
+ ...conversationFixture('t3006', 'Light and dark themes'),
+ 'projectId': 'lead',
+ 'number': 3006,
+ })
+ ..add({
+ ...conversationFixture('t2996', 'Threads, Mentions, Decisions'),
+ 'projectId': 'lead',
+ 'number': 2996,
+ })
+ ..add({...conversationFixture('web-lead', 'Lead'), 'projectId': 'web'});
+ (server.state['people'] as List)
+ ..add({'id': 'dee', 'email': '[email protected]', 'role': 'collaborator'})
+ ..add({'id': 'ken', 'email': '[email protected]', 'role': 'owner'});
+ final now = DateTime.now().toUtc();
+ const river = {'kind': 'agent', 'id': 'lead-agent', 'name': 'Lead'};
+ const dee = {'kind': 'person', 'id': 'dee', 'name': '[email protected]'};
+ const ken = {'kind': 'person', 'id': 'ken', 'name': '[email protected]'};
+ void say(
+ String text,
+ Map<String, Object> author, {
+ String conversation = 'lead',
+ String? thread,
+ int minutesAgo = 0,
+ }) {
+ server.append(text, conversationId: conversation);
+ server.messages.last
+ ..['author'] = author
+ ..['createdAt'] = now
+ .subtract(Duration(minutes: minutesAgo))
+ .toIso8601String();
+ if (thread != null) {
+ server.messages.last
+ ..['thread'] = thread
+ ..['replyTo'] = thread;
+ }
+ }
+
+ say('How do I change from dark mode to light mode?', dee, minutesAgo: 40);
+ final root = server.messages.last['id'] as String;
+ say(
+ 'Appearance > Workspace now opens on Light, Dark and Match macOS, with '
+ 'the light and the dark theme chosen right below.',
+ river,
+ thread: root,
+ minutesAgo: 30,
+ );
+ say('Plum for me, Storm at night.', ken, thread: root, minutesAgo: 12);
+ say(
+ 'Screenshots of each theme are in the task for your look.',
+ river,
+ minutesAgo: 8,
+ );
+ say('Release notes are up for review.', ken, minutesAgo: 2);
+ server.tag(root, threadId: root, messageSequence: server.revision);
+ say(
+ 'Which theme should be the default light one?',
+ river,
+ conversation: 'web-lead',
+ minutesAgo: 5,
+ );
+ server.ask(
+ ['Cloud or Plum as the default light theme?'],
+ conversationId: 'web-lead',
+ projectId: 'web',
+ );
+ ((server.state['conversations'] as List)[0] as Map)['leadId'] = 'lead-agent';
+ return server;
+}
+
+void main() {
+ setUpAll(() => loadCaptureFonts(shots));
+
+ for (final palette in [
+ HarnessPalette.plum,
+ HarnessPalette.cloud,
+ HarnessPalette.night,
+ HarnessPalette.storm,
+ ]) {
+ testWidgets('the Swarm in ${palette.label}', (tester) async {
+ if (shots == null) return;
+ final previous = (
+ grid.AppTheme.palette.value,
+ grid.AppTheme.brightness.value,
+ );
+ grid.AppTheme.palette.value = palette;
+ grid.AppTheme.brightness.value = palette.brightness;
+ addTearDown(() {
+ grid.AppTheme.palette.value = previous.$1;
+ grid.AppTheme.brightness.value = previous.$2;
+ });
+ tester.view.devicePixelRatio = 2;
+ tester.view.physicalSize = const Size(2560, 1500);
+ addTearDown(tester.view.reset);
+ final app = createApp(connected: true);
+ addTearDown(app.dispose);
+ final server = _swarm();
+ final c = server.controller(
+ account: 'dee',
+ initial: {
+ 'tabId': 'tab',
+ 'accountId': 'dee',
+ 'selectedId': 'lead',
+ 'expandedProjects': ['lead'],
+ },
+ );
+ await c.refresh();
+ final attention = SuperTabAttention.of(c);
+ await attention.mentions.load();
+ await attention.decisions.load();
+ await attention.load();
+ SuperTabActivity.of(c);
+ await c.select('lead');
+ final picture = GlobalKey();
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: palette.brightness),
+ home: RepaintBoundary(
+ key: picture,
+ child: Scaffold(
+ body: SuperTabView(
+ controller: c,
+ app: app,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ onNewProject: () {},
+ machineName: (_) => 'Team Mac',
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ Future<void> shot(String scene) => captureBoundary(
+ tester,
+ picture.currentContext!.findRenderObject()! as RenderRepaintBoundary,
+ shots,
+ 'theme-${palette.name}-$scene',
+ );
+
+ await shot('chat');
+ final line = find.byKey(const ValueKey('super-thread-line-message-1'));
+ if (line.evaluate().isNotEmpty) {
+ await tester.tap(line);
+ await tester.pumpAndSettle();
+ await shot('thread');
+ }
+ final activityRow = find.byKey(const ValueKey('super-activity'));
+ if (activityRow.evaluate().isNotEmpty) {
+ await tester.tap(activityRow);
+ await tester.pumpAndSettle();
+ await shot('activity');
+ }
+ await tester.pumpWidget(const SizedBox());
+ await c.flush();
+ c.dispose();
+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
+ }
+
+ testWidgets('Appearance > Workspace in Plum', (tester) async {
+ if (shots == null) return;
+ final store = AppearancePrefsStore(storage: _Memory());
+ addTearDown(store.dispose);
+ await store.setPalette(HarnessPalette.plum);
+ final previous = (
+ grid.AppTheme.palette.value,
+ grid.AppTheme.brightness.value,
+ );
+ grid.AppTheme.palette.value = HarnessPalette.plum;
+ grid.AppTheme.brightness.value = Brightness.light;
+ addTearDown(() {
+ grid.AppTheme.palette.value = previous.$1;
+ grid.AppTheme.brightness.value = previous.$2;
+ });
+ tester.view.devicePixelRatio = 2;
+ tester.view.physicalSize = const Size(880, 1500);
+ addTearDown(tester.view.reset);
+ final picture = GlobalKey();
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: Brightness.light),
+ home: RepaintBoundary(
+ key: picture,
+ child: Scaffold(
+ body: HarnessCustomizePane(onClose: () {}, store: store),
+ ),
+ ),
+ ),
+ );
+ await tester.tap(find.byKey(const ValueKey('customize-appearance')));
+ await tester.pumpAndSettle();
+ await captureBoundary(
+ tester,
+ picture.currentContext!.findRenderObject()! as RenderRepaintBoundary,
+ shots,
+ 'theme-appearance-workspace',
+ );
+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
+}
+
+class _Memory implements LocalKeyValueStore {
+ final values = <String, String>{};
+ @override
+ Future<String?> read(String key) async => values[key];
+ @override
+ Future<void> delete(String key) async => values.remove(key);
+ @override
+ Future<void> write(String key, String value) async => values[key] = value;
+}
diff --git a/desktop/test/theme_palettes_test.dart b/desktop/test/theme_palettes_test.dart
new file mode 100644
index 000000000..a38d6f979
--- /dev/null
+++ b/desktop/test/theme_palettes_test.dart
@@ -0,0 +1,152 @@
+// Task #3006 (Dee, 11-05): four neutral themes modeled on the popular chat
+// apps' light and dark looks, under our own names, each readable on every
+// ground its text meets.
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/shared/theme/color_palette.dart';
+
+double contrast(Color a, Color b) {
+ final x = a.computeLuminance() + .05;
+ final y = b.computeLuminance() + .05;
+ return x > y ? x / y : y / x;
+}
+
+/// Reads the tokens while [palette] is the app's palette.
+T wearing<T>(HarnessPalette palette, T Function() read) {
+ final previousPalette = grid.AppTheme.palette.value;
+ final previousBrightness = grid.AppTheme.brightness.value;
+ grid.AppTheme.palette.value = palette;
+ grid.AppTheme.brightness.value = palette.brightness;
+ try {
+ return read();
+ } finally {
+ grid.AppTheme.palette.value = previousPalette;
+ grid.AppTheme.brightness.value = previousBrightness;
+ }
+}
+
+const newPalettes = [
+ HarnessPalette.plum,
+ HarnessPalette.night,
+ HarnessPalette.cloud,
+ HarnessPalette.storm,
+];
+
+void main() {
+ test('the four themes carry the grounds and text the brief names', () {
+ expect(HarnessPalette.plum.brightness, Brightness.light);
+ expect(HarnessPalette.plum.background, const Color(0xffffffff));
+ expect(HarnessPalette.plum.text, const Color(0xff1d1c1d));
+ expect(HarnessPalette.plum.sidebar, const Color(0xff3f0e40));
+ expect(HarnessPalette.plum.sidebarInk, const Color(0xffffffff));
+
+ expect(HarnessPalette.night.brightness, Brightness.dark);
+ expect(HarnessPalette.night.background, const Color(0xff1a1d21));
+ expect(HarnessPalette.night.sidebar, const Color(0xff19171d));
+
+ expect(HarnessPalette.cloud.brightness, Brightness.light);
+ expect(HarnessPalette.cloud.background, const Color(0xffffffff));
+ expect(HarnessPalette.cloud.sidebar, const Color(0xfff2f3f5));
+ expect(HarnessPalette.cloud.tabBar, const Color(0xffe3e5e8));
+ expect(HarnessPalette.cloud.text, const Color(0xff313338));
+
+ expect(HarnessPalette.storm.brightness, Brightness.dark);
+ expect(HarnessPalette.storm.background, const Color(0xff313338));
+ expect(HarnessPalette.storm.sidebar, const Color(0xff2b2d31));
+ expect(HarnessPalette.storm.tabBar, const Color(0xff1e1f22));
+
+ // Our own plain names, never another product's.
+ for (final palette in newPalettes) {
+ expect(
+ '${palette.label} ${palette.description}'.toLowerCase(),
+ isNot(matches(RegExp('slack|discord|aubergine'))),
+ );
+ }
+ expect(newPalettes.map((p) => p.label), [
+ 'Plum',
+ 'Night',
+ 'Cloud',
+ 'Storm',
+ ]);
+ // Paper and Mist stay, and the default is still Graphite.
+ expect(HarnessPalette.values, contains(HarnessPalette.paper));
+ expect(HarnessPalette.values, contains(HarnessPalette.mist));
+ expect(HarnessPalette.fromId(null), HarnessPalette.graphite);
+ });
+
+ test('every text step clears 4.5:1 on every ground it meets', () {
+ for (final palette in newPalettes) {
+ final grounds = {
+ 'background': palette.background,
+ 'panel': palette.panel,
+ 'card': palette.card,
+ 'hover': palette.hover,
+ 'workspace': palette.workspace,
+ 'search': palette.search,
+ };
+ expect(
+ contrast(palette.text!, palette.background),
+ greaterThanOrEqualTo(7),
+ reason: '${palette.name} text on the chat',
+ );
+ for (final MapEntry(key: name, value: ground) in grounds.entries) {
+ for (final MapEntry(key: step, value: ink) in {
+ 'text': palette.text!,
+ 'muted': palette.muted!,
+ 'faint': palette.faint!,
+ }.entries) {
+ expect(
+ contrast(ink, ground),
+ greaterThanOrEqualTo(4.5),
+ reason: '${palette.name} $step on $name',
+ );
+ }
+ }
+ // The accent is drawn as link text on the chat.
+ expect(
+ contrast(palette.accent, palette.background),
+ greaterThanOrEqualTo(4.5),
+ reason: '${palette.name} accent on the chat',
+ );
+ // The Swarm sidebar's own ink, where the palette has one.
+ final sidebar = palette.sidebar;
+ final ink = palette.sidebarInk ?? palette.text!;
+ final muted = palette.sidebarMuted ?? palette.muted!;
+ for (final ground in [sidebar, palette.sidebarHover]) {
+ expect(contrast(ink, ground), greaterThanOrEqualTo(4.5));
+ expect(contrast(muted, ground), greaterThanOrEqualTo(4.5));
+ }
+ for (final ink in [palette.sidebarOnSelected, muted]) {
+ expect(
+ contrast(ink, palette.sidebarSelected),
+ greaterThanOrEqualTo(4.5),
+ reason: '${palette.name} selected sidebar row',
+ );
+ }
+ }
+ });
+
+ test('the text tokens read the palette\'s own grays', () {
+ for (final palette in newPalettes) {
+ wearing(palette, () {
+ expect(grid.AppPalette.textPrimary, palette.text, reason: palette.name);
+ expect(grid.AppPalette.textSecondary, palette.muted);
+ expect(grid.AppPalette.textFaint, palette.faint);
+ expect(grid.AppPalette.swarmSidebar, palette.sidebar);
+ expect(grid.AppPalette.windowBg, palette.background);
+ });
+ }
+ // The palettes that predate them keep the inks they had.
+ wearing(HarnessPalette.paper, () {
+ expect(grid.AppPalette.textPrimary, const Color(0xFF1A1A18));
+ expect(grid.AppPalette.textSecondary, const Color(0xFF62615B));
+ expect(grid.AppPalette.textFaint, const Color(0xFF7A7973));
+ expect(grid.AppPalette.swarmSidebar, HarnessPalette.paper.workspace);
+ });
+ wearing(HarnessPalette.graphite, () {
+ expect(grid.AppPalette.textPrimary, const Color(0xFFF5F5F5));
+ expect(grid.AppPalette.swarmSidebar, HarnessPalette.graphite.workspace);
+ });
+ });
+}
diff --git a/desktop/test/theme_sidebar_ink_test.dart b/desktop/test/theme_sidebar_ink_test.dart
new file mode 100644
index 000000000..32b54ce9c
--- /dev/null
+++ b/desktop/test/theme_sidebar_ink_test.dart
@@ -0,0 +1,298 @@
+// Task #3006 (Dee, 11-05): Plum is a light theme with one dark surface, the
+// Swarm sidebar, in plum with white text. Every word and mark there must read
+// on it, and the same widgets elsewhere keep the page's ink.
+import 'package:flutter/gestures.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/shared/theme/color_palette.dart';
+import 'package:harness/state/app_state.dart';
+import 'package:harness/super_tabs/identity.dart';
+import 'package:harness/super_tabs/places.dart';
+import 'package:harness/super_tabs/project_sidebar.dart';
+import 'package:harness/super_tabs/section_heading.dart';
+
+import 'super_tab_activity_lists_test.dart' show load, swarm, unreadThread;
+import 'support/super_tab_fixture.dart';
+import 'swarm_state_test.dart' show createApp;
+
+double _contrast(Color a, Color b) {
+ final x = a.computeLuminance() + .05;
+ final y = b.computeLuminance() + .05;
+ return x > y ? x / y : y / x;
+}
+
+void _wear(HarnessPalette palette) {
+ final previous = grid.AppTheme.palette.value;
+ final brightness = grid.AppTheme.brightness.value;
+ grid.AppTheme.palette.value = palette;
+ grid.AppTheme.brightness.value = palette.brightness;
+ addTearDown(() {
+ grid.AppTheme.palette.value = previous;
+ grid.AppTheme.brightness.value = brightness;
+ });
+}
+
+Future<void> _mountSidebar(WidgetTester tester) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = const Size(900, 1000);
+ addTearDown(tester.view.reset);
+ final now = DateTime.now().millisecondsSinceEpoch;
+ final server = ConversationServer();
+ final conversations = server.state['conversations'] as List;
+ final projects = <Map<String, dynamic>>[];
+ for (final name in ['garage-pod', 'lampos', 'openharness']) {
+ projects.add(projectFixture(name, name, 'chat-$name'));
+ conversations.add({
+ ...conversationFixture('chat-$name', name),
+ 'projectId': name,
+ });
+ }
+ server.state['projects'] = projects;
+ for (final (number, status) in [(2419, 'working'), (2394, 'needs_human')]) {
+ conversations.add({
+ ...conversationFixture('t$number', 'Task $number'),
+ 'projectId': 'openharness',
+ 'number': number,
+ 'agentIds': ['lead'],
+ 'assignment': {
+ 'id': 'a$number',
+ 'agentId': 'lead',
+ 'status': status,
+ 'result': status == 'needs_human' ? 'Which machine?' : null,
+ 'progressAt': now - 60000,
+ },
+ });
+ server.append(
+ 'Pushed the next commit.',
+ conversationId: 't$number',
+ agent: true,
+ );
+ }
+ server.append('Can you check this?', conversationId: 'chat-lampos');
+ final c = server.controller(
+ initial: {
+ 'tabId': 'tab',
+ 'accountId': 'owner',
+ 'expandedProjects': ['openharness'],
+ 'selectedId': 'chat-openharness',
+ },
+ );
+ addTearDown(c.dispose);
+ await c.refresh();
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: grid.AppTheme.brightness.value),
+ home: Scaffold(
+ body: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SizedBox(
+ width: 300,
+ child: ProjectSidebar(controller: c, onSelect: c.select),
+ ),
+ const Expanded(
+ child: SuperTabSectionHeading('Outside the sidebar'),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+}
+
+/// The fill right behind [element]: the nearest opaque box or material
+/// under the sidebar (a badge, an avatar's disc, a selected row), else
+/// [ground].
+Color _behind(Element element, Color ground) {
+ Color? found;
+ element.visitAncestorElements((ancestor) {
+ final widget = ancestor.widget;
+ if (widget is ProjectSidebar) return false;
+ final fill = switch (widget) {
+ DecoratedBox(decoration: BoxDecoration(:final color?)) => color,
+ Material(:final color?) => color,
+ ColoredBox(:final color) => color,
+ _ => null,
+ };
+ if (fill != null && fill.a > .5) {
+ found = fill;
+ return false;
+ }
+ return true;
+ });
+ return found ?? ground;
+}
+
+/// Every text and icon color drawn under [of], each with the fill behind it.
+List<(String, Color, Color)> _inks(
+ WidgetTester tester,
+ Finder of,
+ Color ground,
+) {
+ // A list, not a map: the same words (a count of 1) may appear twice.
+ final inks = <(String, Color, Color)>[];
+ // An avatar is drawn on its own disc, whatever the theme.
+ final avatars = find
+ .descendant(
+ of: find.byType(SuperTabAvatar),
+ matching: find.byType(RichText),
+ )
+ .evaluate()
+ .toSet();
+ for (final element
+ in find
+ .descendant(of: of, matching: find.byType(RichText))
+ .evaluate()
+ .where((element) => !avatars.contains(element))) {
+ final paragraph = element.renderObject! as RenderParagraph;
+ final behind = _behind(element, ground);
+ paragraph.text.visitChildren((span) {
+ if (span is TextSpan) {
+ final color = span.style?.color ?? paragraph.text.style?.color;
+ final text = span.toPlainText().trim();
+ if (color != null && text.isNotEmpty) {
+ inks.add((text, Color.alphaBlend(color, behind), behind));
+ }
+ }
+ return true;
+ });
+ }
+ for (final element
+ in find.descendant(of: of, matching: find.byType(Icon)).evaluate()) {
+ final icon = element.widget as Icon;
+ final color = icon.color ?? IconTheme.of(element).color;
+ if (color != null) {
+ final behind = _behind(element, ground);
+ inks.add((
+ 'icon ${icon.icon?.codePoint}',
+ Color.alphaBlend(color, behind),
+ behind,
+ ));
+ }
+ }
+ return inks;
+}
+
+void _expectReadable(List<(String, Color, Color)> inks, String where) {
+ expect(inks, isNotEmpty);
+ for (final (what, ink, behind) in inks) {
+ expect(
+ _contrast(ink, behind),
+ greaterThanOrEqualTo(what.startsWith('icon') ? 3 : 4.5),
+ reason: '"$what" ${what.codeUnits} on $where',
+ );
+ }
+}
+
+void main() {
+ testWidgets('Plum\'s sidebar is plum and everything on it reads', (
+ tester,
+ ) async {
+ _wear(HarnessPalette.plum);
+ await _mountSidebar(tester);
+ final sidebar = find.byType(ProjectSidebar);
+ expect(
+ find.descendant(
+ of: sidebar,
+ matching: find.byWidgetPredicate(
+ (w) => w is Material && w.color == const Color(0xff3f0e40),
+ ),
+ ),
+ findsWidgets,
+ );
+ final ground = HarnessPalette.plum.sidebar;
+ _expectReadable(_inks(tester, sidebar, ground), 'the plum sidebar');
+
+ // Hovering a row keeps it readable.
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ addTearDown(mouse.removePointer);
+ await mouse.addPointer(location: Offset.zero);
+ await mouse.moveTo(tester.getCenter(find.text('lampos')));
+ await tester.pumpAndSettle();
+ // Under the pointer the row darkens to the hover fill; what sat on the
+ // sidebar itself must read there too.
+ final hover = HarnessPalette.plum.sidebarHover;
+ _expectReadable([
+ for (final (what, ink, behind) in _inks(tester, sidebar, ground))
+ (what, ink, behind == ground ? hover : behind),
+ ], 'a hovered plum row');
+
+ // The same heading outside the sidebar keeps the page's gray.
+ final outside = tester.renderObject<RenderParagraph>(
+ find.text('Outside the sidebar'),
+ );
+ expect(outside.text.style!.color, HarnessPalette.plum.muted);
+ expect(tester.takeException(), isNull);
+ });
+
+ testWidgets('a theme without a sidebar of its own keeps the page ink', (
+ tester,
+ ) async {
+ _wear(HarnessPalette.cloud);
+ await _mountSidebar(tester);
+ final sidebar = find.byType(ProjectSidebar);
+ expect(
+ find.descendant(
+ of: sidebar,
+ matching: find.byWidgetPredicate(
+ (w) => w is Material && w.color == HarnessPalette.cloud.sidebar,
+ ),
+ ),
+ findsWidgets,
+ );
+ final ground = HarnessPalette.cloud.sidebar;
+ _expectReadable(_inks(tester, sidebar, ground), 'Cloud\'s sidebar');
+ });
+
+ testWidgets('on Plum, Threads, Mentions and Decisions read too, counts '
+ 'and arrows included', (tester) async {
+ _wear(HarnessPalette.plum);
+ final server = swarm()..state['swarmBuddy'] = true;
+ server.ask(['Ship it?']);
+ server.tag('message-1');
+ server.followedThreads = {
+ 'unread': [unreadThread('message-1')],
+ 'read': [],
+ 'more': false,
+ };
+ final activity = (await tester.runAsync(() => load(server)))!;
+ final c = activity.controller;
+ final AppNotifier app = createApp();
+ addTearDown(app.dispose);
+ await tester.binding.setSurfaceSize(const Size(280, 800));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.light),
+ home: Scaffold(
+ body: ProjectSidebar(
+ controller: c,
+ app: app,
+ onSelect: c.select,
+ onNewSwarm: () {},
+ onNewProject: () {},
+ onPage: (_) {},
+ activity: activity,
+ attention: activity.attention,
+ places: SuperTabPlaces.of(c),
+ onManage: () {},
+ ),
+ ),
+ ),
+ );
+ await tester.pump();
+ addTearDown(() => tester.pumpWidget(const SizedBox()));
+ final threads = find.byKey(const ValueKey('super-threads'));
+ expect(
+ find.descendant(of: threads, matching: find.text('1')),
+ findsOneWidget,
+ );
+ _expectReadable(
+ _inks(tester, find.byType(ProjectSidebar), HarnessPalette.plum.sidebar),
+ 'the plum sidebar with Threads, Mentions and Decisions',
+ );
+ });
+}
diff --git a/desktop/test/windows_words_test.dart b/desktop/test/windows_words_test.dart
index bd5806545..ca5437ea8 100644
--- a/desktop/test/windows_words_test.dart
+++ b/desktop/test/windows_words_test.dart
@@ -11,6 +11,8 @@ const _sayMacBehindACheck = {
'lib/models/model_search_catalog.dart',
'lib/notify/system_notifications.dart',
'lib/settings/sections/terminal_section.dart',
+ // AppearanceMode.labelFor says Match system off the Mac (#3006).
+ 'lib/shared/theme/appearance_prefs_store.dart',
'lib/shortcuts/shortcut_recorder.dart',
'lib/state/harness_monitor.dart',
'lib/super_tabs/team_account_setup.dart',
diff --git a/docs/plans/2026-11-05-light-dark-themes-plan.md b/docs/plans/2026-11-05-light-dark-themes-plan.md
new file mode 100644
index 000000000..f996526dd
--- /dev/null
+++ b/docs/plans/2026-11-05-light-dark-themes-plan.md
@@ -0,0 +1,105 @@
+# Light and dark themes, plus Match macOS — plan (task #3006)
+
+**Goal:** Four neutral palettes modeled on the two popular chat apps' light and dark looks, under our own names, and a
+Light / Dark / Match macOS choice at the top of Appearance > Workspace that picks between a chosen light palette and a
+chosen dark one. Match macOS follows the system setting live. Paper and Mist stay; terminal colors keep their own
+setting; someone who never opens Appearance keeps today's Graphite.
+
+**Architecture:** Every surface already reads one effective palette (`AppearancePrefs.palette` →
+`AppTheme.palette` → tokens, native window). That stays the single source. The store gains the mode and the two
+slots, and resolves the effective palette from them and the system brightness, which it follows through a
+`WidgetsBindingObserver`. No consumer of `prefs.palette` changes. Palettes gain optional ink overrides (text, muted,
+faint) so the new ones carry their own grays, and an optional dark sidebar ("island") for the light palette whose
+sidebar is a deep plum with white text; the Swarm sidebar reads its ink from a `SidebarInk` scope so shared row widgets
+change only inside it.
+
+**Tech Stack:** Flutter (Desktop, web shares the code), `flutter_test` widget tests with a memory store.
+
+**Spec:** task #3006 brief (Dee's thread in the project chat, 2026-11-05).
+
+## Global Constraints
+
+- Names: Plum (white, plum sidebar), Night (near-black), Cloud (white, gray sidebars), Storm (gray, darker rail). No
+ other product's name in the app or its copy.
+- Text at least 4.5:1 on every ground it meets; primary text at least 7:1 on the chat ground.
+- One accent per palette for links, the unread dot and buttons; red only for counts.
+- Don't touch `project_sidebar.dart`, `activity_view.dart`, `thread_panel.dart` beyond color tokens (#2996).
+- Compatibility: `app_color_palette` keeps holding the effective palette, so an older build opens in the same look (an
+ older build that doesn't know a new id falls back to Graphite, as for any unknown id). A build without a saved mode
+ derives it from the saved palette's brightness.
+- Desktop tests use a memory store and never sign anything in.
+
+## Review Focus
+
+- The effective palette is the only thing consumers read; mode changes never leave `AppTheme.palette`, the Material
+ theme and the native payload disagreeing.
+- Match macOS: the observer is added once and removed on dispose; a system flip only changes the palette in Match mode.
+- Persistence ordering under rapid choices (the existing coalescing pattern) and tolerant loading of hand-edited ids
+ (a dark id in the light slot falls back).
+- Sidebar island: every ink in the Swarm sidebar reads `SidebarInk`, and nothing outside the sidebar changes.
+
+## Design
+
+- growth: four enum values and three small keys in the existing preferences file; nothing accumulates.
+- concurrency: one ValueNotifier on the UI isolate; writes coalesce as today's palette write does.
+- read cost: the system brightness is pushed by the engine on change; nothing polls.
+- scale: N/A because it is one local preference per computer.
+- compatibility: older builds read `app_color_palette` (still written with the effective palette); newer builds
+ without a saved mode derive it.
+- migration + rollback: no migration; rolling back leaves the effective palette in the old key.
+- audience: N/A because it is a local preference with no server.
+- identity: N/A because nothing is sent.
+- failure: a failed write keeps the choice for the run, as today.
+- platforms: macOS, Windows, Linux and web; the third choice reads "Match macOS" on macOS and "Match system"
+ elsewhere.
+
+## Task 1: Four palettes and their inks
+
+**Files:** `desktop/lib/shared/theme/color_palette.dart`, `desktop/lib/shared/theme/app_theme.dart`,
+`desktop/test/theme_palettes_test.dart`
+
+**Interfaces:** `HarnessPalette.plum|night|cloud|storm`; optional `text`, `muted`, `faint`, `sidebar`, `sidebarInk`;
+`AppPalette.textPrimary/textSecondary/textFaint` read the palette's overrides when set; `AppPalette.swarmSidebar`.
+
+- [ ] Failing test: the four exist with the brief's grounds (#FFFFFF chat and #1D1C1D text; #1A1D21 and #19171D;
+ #FFFFFF, #F2F3F5, #E3E5E8 and #313338; #313338, #2B2D31, #1E1F22), contrast floors hold for every text step
+ on every ground, and the tokens read each palette's grays.
+- [ ] Code: the four palettes, the overrides and the token reads.
+
+## Task 2: Light / Dark / Match macOS in the store
+
+**Files:** `desktop/lib/shared/theme/appearance_prefs_store.dart`, `desktop/lib/app_shell.dart`,
+`desktop/test/theme_mode_test.dart`
+
+**Interfaces:** `enum AppearanceMode { light, dark, system }`; `AppearancePrefs.mode/lightPalette/darkPalette`;
+`AppearancePrefsStore.setMode`, `setPalette` (fills the slot of the palette's brightness; in Light or Dark it also
+moves the mode to that brightness), `followSystemBrightness()`.
+
+- [ ] Failing tests: default is Dark + Graphite; Light/Dark pick their slot; Match follows a system flip live
+ (`platformBrightnessTestValue`) and only in Match; choices persist and reload; a saved palette without a mode
+ derives it; a hand-edited dark id in the light slot falls back.
+- [ ] Code.
+
+## Task 3: Appearance > Workspace
+
+**Files:** `desktop/lib/settings/appearance/palette_section.dart`, `desktop/test/theme_mode_test.dart`
+
+- [ ] Failing widget tests: the three-way choice sits at the top of Workspace; Light and Dark switch the app; Match
+ macOS with a system flip switches it live; the light and dark palettes are chosen in their own groups below.
+- [ ] Code.
+
+## Task 4: The plum sidebar
+
+**Files:** `desktop/lib/shared/theme/app_theme.dart` (`SidebarInk`), `desktop/lib/super_tabs/project_sidebar.dart`
+(color tokens only), the sidebar's shared rows, `desktop/test/theme_palettes_test.dart`
+
+- [ ] Failing test: in Plum the Swarm sidebar is #3F0E40 and its row text is white at 4.5:1 or better, while the same
+ rows outside the sidebar keep the page's ink.
+- [ ] Code.
+
+## Task 5: Screenshots
+
+**Files:** `desktop/test/theme_palettes_shots_test.dart`
+
+- [ ] Env-gated capture of the Swarm chat with its sidebar, a thread, and Decisions in each new palette, plus the
+ Appearance pane; sent to Dee in the task.