remove the multi-theme system

This commit is contained in:
2026-10-09 15:58:26 +07:00
parent 8e34ddabcb
commit 7dcc8033c9
25 changed files with 214 additions and 2718 deletions
+51 -22
View File
@@ -477,38 +477,67 @@ Follow-ups noted: chat_ui paints delivery/status marks with hardcoded
status-dot recipe in a later polish pass; warning strips carry no 20%-alpha
ring (no border existed; adding one is a structure change).
### Phase 4 — Settings, registry, shipped themes
### Phase 4 — Settings, appearance, and the removal of the multi-theme system (done)
- [ ] `crates/settings/src/lib.rs`: replace persisted `theme_mode: ThemeMode`
with `appearance_mode: AppearanceMode` (`System`/`Light`/`Dark`).
Serde-compat: custom `Deserialize` that maps the old `Light`/`Dark`
values and falls back to `System` (or version the field) so existing
configs keep loading. `apply_theme` becomes: install registry overrides
→ `set_brand` → `appearance::set_mode`.
- [ ] `ThemeRegistry` + `assets/themes/*.json`: new schema —
`{ id, name, author, brand?: { tint, accent, radius }, overrides: {
light?: {...}, dark?: {...} } }` where overrides are a *subset* of
semantic tokens. Re-derive the 8 shipped themes as override deltas over
the new base palette (catppuccin hues go through `Brand.tint`; only hues
rotation cannot reach stay as overrides — flexoki is the likely
candidate).
- [ ] `workspace/src/dialogs/settings.rs`: add the `System` appearance option
next to Light/Dark.
- [ ] Contrast tests from Phase 1 run against every registered theme — a
shipped theme that fails contrast is a bug in that JSON, fix the JSON.
The original plan (appearance_mode with back-compat, registry re-schema,
brand-izing the 8 shipped JSONs) was superseded by a decision: **coop no
longer ships multiple themes**. The bezel token palettes (dark and light,
optionally rotated by a `Brand`) are the only theming surface. Done:
- [x] `crates/settings`: persisted `theme_mode: ThemeMode` →
`appearance_mode: AppearanceMode` with
`#[serde(default, alias = "theme_mode")]` — an old config's pinned
Light/Dark survives; absence falls back to `System`. Round-trip tests
cover both. `set_theme`/`reset_theme` deleted; `apply_theme` is now
`cx.set_appearance_mode(mode)`.
- [x] `ThemeRegistry`, `assets/themes/*.json` (8 files), and the
`themes/**/*` asset embed are deleted. `theme::init` is
`appearance::init` + scrollbar sync.
- [x] `ThemeFamily`, `from_file`/`from_assets`, the theme picker dialog
(`theme_selector` + `Command::ToggleTheme` + its header/greeter menu
entries), and the settings dialog's "Reset theme" row are deleted.
The appearance picker is now System/Light/Dark via
`AppearanceMode::ALL` and `AppExt::set_appearance_mode`.
- [x] The old-schema JSON bridge (`rederive_tokens`, `sync_legacy`,
`legacy_default`) is gone with the schema.
### Phase 5 — Removal and docs (done)
- [x] Deleted `ThemeColors` legacy fields (~60), `ColorScale`/`ColorScaleSet`
(`scale.rs`), `ThemeColors::light/dark` wrappers, `Theme::apply_theme`,
and the `Theme` fields `theme: Rc<ThemeFamily>`, `radius`, `radius_lg`
(every site reads the ratio functions now). `ThemeColors` stays public:
it *is* the token set, in the bezel style.
- [x] `crates/ui/src/scroll/scrollable.rs` no longer paints scrollbar colors
from coop tokens — gpui-base's `Scrollbar` paints from its own global
theme (kept in step by `sync_base`'s scrollbar mode), with base's
defaults for thumb/track.
- [x] `ui::init` boot order verified: `theme::init` (appearance::init)
runs before the first window in desktop and web; workspace still
observes window appearance for live System flips. Desktop/web
comments updated.
- [x] Final census: only new token names remain; workspace compiles; tests
green (theme 5, settings 2 incl. serde compat, 52 chat_ui).
Follow-ups noted: chat_ui's hardcoded `gpui::green()`/`red()` status marks
are candidates for the `success`/`busy`/`danger` status-dot recipe; the
nip29 pin chip pairs `solid` with a `text_muted` label (predates the
migration) — flip its label to `on_solid` if it reads loud.
### Phase 5 — Removal and docs
- [ ] Delete `ThemeColors`, the deprecated aliases, `ColorScale`/
*(Executed together with Phase 4 — see above.)*
- [x] Delete `ThemeColors`, the deprecated aliases, `ColorScale`/
`ColorScaleSet` public exports (`scale.rs` either goes private as the
palette generator's internal or is deleted), `ThemeMode`.
- [ ] `crates/ui/src/lib.rs`: `theme::init` already runs `appearance::init`;
- [x] `crates/ui/src/lib.rs`: `theme::init` already runs `appearance::init`;
verify `ui::init`'s callers boot the theme before the first window, and
that every opened window observes appearance changes
(`theme::observe_window` or workspace's sync-on-activation hook).
- [ ] Update `README`/docs mentions of theme customization; document
- [x] Update `README`/docs mentions of theme customization; document
`Brand` + override JSON as the two supported ways to theme coop.
- [ ] Final census run: only new token names remain.
- [x] Final census run: only new token names remain.
## Risks