This commit is contained in:
Forrest 2026-08-05 21:57:06 -04:00
parent 2ce32cac4e
commit b6639fb1c9
26 changed files with 454 additions and 204 deletions

View file

@ -9,16 +9,18 @@ import 'tokens.dart';
/// (a close analog to the terminal fonts in Timbre's screenshots). The [accent]
/// is passed in so the theme rebuilds when album-art extraction changes it.
ThemeData buildTimbreTheme(Color accent) {
final mono = GoogleFonts.jetBrainsMonoTextTheme(
ThemeData.dark().textTheme,
).apply(
final brightness = TimbreColors.brightness;
final base = brightness == Brightness.light
? ThemeData.light()
: ThemeData.dark();
final mono = GoogleFonts.jetBrainsMonoTextTheme(base.textTheme).apply(
bodyColor: TimbreColors.foreground,
displayColor: TimbreColors.foreground,
);
final scheme = ColorScheme.fromSeed(
seedColor: accent,
brightness: Brightness.dark,
brightness: brightness,
surface: TimbreColors.surface,
).copyWith(
primary: accent,
@ -28,7 +30,7 @@ ThemeData buildTimbreTheme(Color accent) {
return ThemeData(
useMaterial3: true,
brightness: Brightness.dark,
brightness: brightness,
scaffoldBackgroundColor: TimbreColors.background,
canvasColor: TimbreColors.background,
colorScheme: scheme,
@ -38,7 +40,7 @@ ThemeData buildTimbreTheme(Color accent) {
splashFactory: NoSplash.splashFactory,
highlightColor: Colors.transparent,
// Keep chrome flat and quiet — the content (and accent) carry the look.
appBarTheme: const AppBarTheme(
appBarTheme: AppBarTheme(
backgroundColor: TimbreColors.background,
surfaceTintColor: Colors.transparent,
elevation: 0,

View file

@ -1,36 +1,96 @@
import 'package:flutter/widgets.dart';
/// A full color palette for one selectable app theme. Immutable; the app swaps
/// which instance is [TimbreColors._active] when the user changes theme.
class TimbrePalette {
const TimbrePalette({
required this.brightness,
required this.background,
required this.surface,
required this.foreground,
required this.dimmed,
required this.border,
required this.borderActive,
required this.accentDefault,
});
final Brightness brightness;
final Color background;
final Color surface;
final Color foreground;
final Color dimmed;
final Color border;
final Color borderActive;
final Color accentDefault;
/// The original near-black, low-contrast theme (the app's default).
static const TimbrePalette dark = TimbrePalette(
brightness: Brightness.dark,
background: Color(0xFF1A1A1A),
surface: Color(0xFF161616),
foreground: Color(0xFFD4D0C8),
dimmed: Color(0xFF5A5858),
border: Color(0xFF252525),
borderActive: Color(0xFF3A3A3A),
accentDefault: Color(0xFFFF8C00),
);
/// A light theme: lavender canvas, slightly-deeper-lavender panels, deep-indigo
/// text and accent. The accent is locked to [accentDefault] while this theme
/// is active (see `main.dart`).
static const TimbrePalette lavender = TimbrePalette(
brightness: Brightness.light,
background: Color(0xFFD3D3FF), // lavender canvas (primary)
surface: Color(0xFFC6C6F4), // slightly darker lavender panels
foreground: Color(0xFF2E2A45), // deep-indigo text
dimmed: Color(0xFF6A6688), // muted indigo-grey
border: Color(0xFFB9B9E8), // deeper-lavender hairline
borderActive: Color(0xFF2E2A45), // accent-toned active border
accentDefault: Color(0xFF2E2A45), // deep indigo (accent)
);
}
/// Design tokens mirroring Timbre's `dynamic`/`static` theme defaults
/// (see timbre `docs/sample-config.toml`, `theme.rs`, `color.rs`).
///
/// The palette is intentionally near-black and low-contrast; the *accent*
/// is the one lively color and, in the `dynamic` theme, is extracted live
/// from the current album art (Phase 2). Everything else stays fixed.
/// The palette is intentionally near-black and low-contrast in the default
/// theme; the *accent* is the one lively color and, in the `dynamic` theme, is
/// extracted live from the current album art. The base colors are no longer
/// compile-time constants — they resolve through [_active] so a user-selected
/// theme (see [TimbrePalette]) recolors the whole app. `applyPalette` is called
/// once per build by `TimbreApp` before the theme is built.
class TimbreColors {
const TimbreColors._();
/// App canvas — `background = #1a1a1a`.
static const Color background = Color(0xFF1A1A1A);
static TimbrePalette _active = TimbrePalette.dark;
/// Panel/surface fill — `surface = #161616` (slightly darker than canvas).
static const Color surface = Color(0xFF161616);
/// Swap the active palette. Called by `TimbreApp.build` from the persisted
/// theme setting; a re-keyed subtree remount then re-reads these getters.
static void applyPalette(TimbrePalette p) => _active = p;
/// Primary text — `foreground = #d4d0c8` (warm off-white, not pure white).
static const Color foreground = Color(0xFFD4D0C8);
/// Brightness of the active theme (drives `ThemeData`/`ColorScheme`).
static Brightness get brightness => _active.brightness;
/// Secondary/muted text — `dimmed = #5a5858`.
static const Color dimmed = Color(0xFF5A5858);
/// App canvas.
static Color get background => _active.background;
/// Hairline borders (inactive) — `border = #252525`.
static const Color border = Color(0xFF252525);
/// Panel/surface fill (slightly offset from the canvas).
static Color get surface => _active.surface;
/// Hairline borders when a pane is focused — `border_active`.
/// Timbre tints this toward the accent; we start with a lighter grey and
/// swap in the accent at runtime once art extraction lands.
static const Color borderActive = Color(0xFF3A3A3A);
/// Primary text.
static Color get foreground => _active.foreground;
/// Default accent — `accent = #ff8c00`. Overridden per-track in `dynamic`.
static const Color accentDefault = Color(0xFFFF8C00);
/// Secondary/muted text.
static Color get dimmed => _active.dimmed;
/// Hairline borders (inactive).
static Color get border => _active.border;
/// Hairline borders when a pane is focused.
static Color get borderActive => _active.borderActive;
/// Default accent when no art-derived accent applies.
static Color get accentDefault => _active.accentDefault;
}
/// Spacing scale — dense, "player as instrument" rather than airy mobile cards.