theme: terminal and editor follow the app's color scheme, re-theming in place

The app resolves light/dark from prefers-color-scheme and the user's
choice (body[data-ds-dark-theme]), but xterm and CodeMirror were pinned to
hardcoded dark themes — a light-mode user got a dark card inside a light
panel. New theme.ts reads the resolved scheme + token values and notifies
on flips (the presenter toggles the body attribute); the terminal now takes
its surface colors from the tokens and a curated one-dark/one-light ANSI
palette, and the editor gets a token-driven surface with the same curated
syntax palettes. Both re-theme in place on a scheme flip: the terminal
re-applies its theme, the editor reconfigures a Compartment holding only
the scheme-dependent extensions, so the document, undo history and scroll
survive. one-dark is dropped (superseded by the curated highlight style).
This commit is contained in:
Menghuan1918
2026-08-08 17:29:13 +08:00
parent d1cdca3324
commit 7aa24badf0
6 changed files with 255 additions and 24 deletions
+1 -1
View File
@@ -48,8 +48,8 @@
"@codemirror/legacy-modes": "^6.5.3",
"@codemirror/search": "^6.7.1",
"@codemirror/state": "^6.7.1",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.43.8",
"@lezer/highlight": "^1.2.3",
"@xterm/addon-fit": "^0.10.0",
"clsx": "^2.1.1",
"node-pty": "^1.1.0",