Skip to content

Commit 1b621a2

Browse files
fix(themes): add dark-theme toggle overrides for network cache settings
The network cache and persistent cache toggles were unreadable in metro-teal and neon-love because bg-primary/bg-muted resolve to near-identical colors. Add explicit background-color overrides matching the existing lastfm-toggle pattern. - Add docs/theming.md documenting the toggle override pattern - Reference theming guide from AGENTS.md quick reference table - Create TASK-299 to port remaining legacy themes and remove themes.json Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent aaefd99 commit 1b621a2

4 files changed

Lines changed: 104 additions & 5 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Always use Context7 MCP when I need library/API documentation, code generation,
4747
| MCP bridge tools | [MCP Tool Reference](docs/mcp-reference.md) |
4848
| Remote debugging, crash analysis | [Debugging Guide](docs/debugging.md) |
4949
| Last.fm scrobbling | [Last.fm Integration](docs/lastfm.md) |
50+
| Themes, dark mode toggle fixes | [Theming Guide](docs/theming.md) |
5051
| Cross-platform builds, CI/CD | [Build Configuration](docs/builds.md) |
5152

5253
## Architecture Overview

app/frontend/styles.css

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,16 @@ aside button:hover svg {
339339
color: #00C4CC !important;
340340
}
341341

342-
/* Metro-teal scrobbling toggle needs explicit colors (Tailwind bg-primary/bg-muted resolve transparent) */
343-
[data-theme-preset='metro-teal'] [data-testid='lastfm-toggle'].bg-muted {
342+
/* Metro-teal toggle overrides (Tailwind bg-primary/bg-muted resolve transparent) */
343+
[data-theme-preset='metro-teal'] [data-testid='lastfm-toggle'].bg-muted,
344+
[data-theme-preset='metro-teal'] [data-testid='network-cache-toggle'].bg-muted,
345+
[data-theme-preset='metro-teal'] [data-testid='network-cache-persistent-toggle'].bg-muted {
344346
background-color: hsl(0 0% 25%) !important;
345347
}
346348

347-
[data-theme-preset='metro-teal'] [data-testid='lastfm-toggle'].bg-primary {
349+
[data-theme-preset='metro-teal'] [data-testid='lastfm-toggle'].bg-primary,
350+
[data-theme-preset='metro-teal'] [data-testid='network-cache-toggle'].bg-primary,
351+
[data-theme-preset='metro-teal'] [data-testid='network-cache-persistent-toggle'].bg-primary {
348352
background-color: hsl(184 100% 38%) !important;
349353
}
350354

@@ -497,11 +501,15 @@ aside button:hover svg {
497501
color: #41C8E5 !important;
498502
}
499503

500-
[data-theme-preset='neon-love'] [data-testid='lastfm-toggle'].bg-muted {
504+
[data-theme-preset='neon-love'] [data-testid='lastfm-toggle'].bg-muted,
505+
[data-theme-preset='neon-love'] [data-testid='network-cache-toggle'].bg-muted,
506+
[data-theme-preset='neon-love'] [data-testid='network-cache-persistent-toggle'].bg-muted {
501507
background-color: hsl(268 30% 25%) !important;
502508
}
503509

504-
[data-theme-preset='neon-love'] [data-testid='lastfm-toggle'].bg-primary {
510+
[data-theme-preset='neon-love'] [data-testid='lastfm-toggle'].bg-primary,
511+
[data-theme-preset='neon-love'] [data-testid='network-cache-toggle'].bg-primary,
512+
[data-theme-preset='neon-love'] [data-testid='network-cache-persistent-toggle'].bg-primary {
505513
background-color: hsl(191 76% 58%) !important;
506514
}
507515

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
id: TASK-299
3+
title: Implement remaining themes from themes.json and remove legacy file
4+
status: To Do
5+
assignee: []
6+
created_date: '2026-03-19 03:56'
7+
labels:
8+
- frontend
9+
- themes
10+
- cleanup
11+
dependencies: []
12+
references:
13+
- themes.json
14+
- app/frontend/styles.css
15+
- docs/theming.md
16+
documentation:
17+
- docs/theming.md
18+
priority: low
19+
---
20+
21+
## Description
22+
23+
<!-- SECTION:DESCRIPTION:BEGIN -->
24+
`themes.json` is a legacy file from the tkinter-era backend containing theme definitions that were never ported to the Tauri/Tailwind CSS frontend. Three themes are defined but not implemented as CSS presets:
25+
26+
- **midnight** — dark theme with blue primary (#0a21f5)
27+
- **nightout** — dark theme with blue primary (#164fe2)
28+
- **spotify** — dark theme with green primary (#1DB954)
29+
30+
`metro-teal` is already implemented in `styles.css`. After porting the remaining three, delete `themes.json`.
31+
32+
Each new theme needs:
33+
1. CSS custom properties under `[data-theme-preset='<name>']` in `styles.css`
34+
2. Toggle overrides for `bg-primary`/`bg-muted` (see `docs/theming.md`)
35+
3. Entry in the theme picker UI
36+
4. Visual regression test snapshots
37+
<!-- SECTION:DESCRIPTION:END -->
38+
39+
## Acceptance Criteria
40+
<!-- AC:BEGIN -->
41+
- [ ] #1 midnight, nightout, and spotify themes implemented as CSS presets in styles.css
42+
- [ ] #2 Each theme has dark-mode toggle overrides for bg-primary/bg-muted (per docs/theming.md)
43+
- [ ] #3 Each theme selectable from the Appearance settings theme picker
44+
- [ ] #4 Visual regression snapshots added for each new theme
45+
- [ ] #5 themes.json deleted from repo root
46+
<!-- AC:END -->

docs/theming.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Theming
2+
3+
## Theme Presets
4+
5+
MT ships with three themes defined in `app/frontend/styles.css`:
6+
7+
| Preset | Type | CSS vars defined under |
8+
|--------|------|----------------------|
9+
| (default) | Light | `:root` |
10+
| `metro-teal` | Dark | `[data-theme-preset='metro-teal']` |
11+
| `neon-love` | Dark | `[data-theme-preset='neon-love']` |
12+
13+
## Dark Theme Toggle Overrides
14+
15+
Tailwind's `bg-primary` and `bg-muted` utilities resolve to near-identical colors in the dark themes, making toggle switches unreadable. Any toggle button that uses `bg-primary`/`bg-muted` for its enabled/disabled state **must** have explicit `background-color` overrides for both `metro-teal` and `neon-love`.
16+
17+
Existing pattern in `styles.css`:
18+
19+
```css
20+
/* metro-teal */
21+
[data-theme-preset='metro-teal'] [data-testid='my-toggle'].bg-muted {
22+
background-color: hsl(0 0% 25%) !important;
23+
}
24+
[data-theme-preset='metro-teal'] [data-testid='my-toggle'].bg-primary {
25+
background-color: hsl(184 100% 38%) !important;
26+
}
27+
28+
/* neon-love */
29+
[data-theme-preset='neon-love'] [data-testid='my-toggle'].bg-muted {
30+
background-color: hsl(268 30% 25%) !important;
31+
}
32+
[data-theme-preset='neon-love'] [data-testid='my-toggle'].bg-primary {
33+
background-color: hsl(191 76% 58%) !important;
34+
}
35+
```
36+
37+
When adding a new toggle to settings, add its `data-testid` selector to the existing grouped rules (search for `toggle overrides` in `styles.css`).
38+
39+
## Adding a New Theme
40+
41+
1. Define CSS custom properties under a new `[data-theme-preset='name']` selector
42+
2. Add the preset to `themes.json`
43+
3. Check all toggles are readable in the new theme — add overrides if `bg-primary`/`bg-muted` lack contrast
44+
4. Run visual regression tests: `cd app/frontend && npx playwright test tests/visual-regression.spec.js`

0 commit comments

Comments
 (0)