Querya Desktop uses a VS Code–inspired theme pipeline: workbench chrome colors,
editor syntax tokens, and optional import of community .json / .jsonc themes.
Theme system epic (#37) — shipped in 0.4.0 (2026-05-28).
Delivered: models (#38), JSONC parser (#39), ThemeController (#40–41), Preferences +
import (#43–45), tokenColors → syntax highlight (#46–47, #49–50), P0 workbench tokens
(#42, #59–60), tests (#58), docs/theme.md (#55), Querya Light (#51), optional theme
animation (#57), editor package spikes (#48, #52).
Follow-up (not blocking): P2 surfaces (Mongo/Redis explorer semantic hues), re_editor
if large-buffer benchmarks fail — see archive/code-forge-evaluation.md.
flowchart TB
subgraph input [Input]
VSCode["VS Code theme file\n(colors + tokenColors)"]
Prefs["Preferences overrides"]
end
subgraph parse [Parser]
JSONC["stripJsonc"]
Manifest["VsCodeThemeManifest"]
Map["vscode_color_map"]
Tokens["TokenStyleResolver"]
end
subgraph models [Runtime models]
WB["QueryaWorkbenchTheme"]
ED["QueryaEditorTheme"]
QT["QueryaTheme"]
end
subgraph ui [UI]
Scope["QueryaThemeScope"]
Shadcn["ShadcnApp ColorScheme"]
Editor["QueryaCodeEditor\nsyntax_highlight"]
end
VSCode --> JSONC --> Manifest
Manifest --> Map --> WB
Manifest --> Map --> ED
Manifest --> Tokens --> ED
Prefs --> Map
WB --> QT
ED --> QT
QT --> Scope
QT --> Shadcn
QT --> Editor
| Layer | Purpose |
|---|---|
| Workbench | Sidebar, tabs, canvas, accents, git decoration |
| Editor | SQL/JSON editor surface, selection, line numbers, syntax token hues |
| ColorScheme | shadcn/Material widgets (buttons, inputs, dialogs) |
ThemeController merges layers, persists settings in AppSettings, and drives
QueryaApp via ListenableBuilder.
- Querya Dark — default (
QueryaThemePreset.queryaDark) - Querya Light — built-in light UI (
QueryaThemePreset.queryaLight); slate canvas, cyan accent, WCAG AA body text - Imported — after a VS Code file is imported (
QueryaThemePreset.imported)
Access tokens in widgets:
final workbench = context.workbench;
final editor = context.editorTheme;
final scheme = Theme.of(context).colorScheme;Requires QueryaThemeScope above the widget (provided by QueryaApp).
Supported keys are listed in theme-import.md and defined in
lib/core/theme/parser/vscode_color_map.dart.
Merge order for the active theme:
effectiveColors = merge(importedTheme.colors, userOverrides)
Built-in preset values apply for keys not present in the merged map.
Stored in theme_overrides_json as VS Code key → hex:
{
"sideBar.background": "#1a1a2e",
"editor.background": "#16161e",
"focusBorder": "#89b4fa"
}API:
await ThemeController.instance.setWorkbenchColor('sideBar.background', color);
await ThemeController.instance.clearColorOverrides();tokenColors entries map TextMate scopes to foreground/background/fontStyle.
TokenStyleResolver resolves scopes by longest prefix (keyword.control.sql →
keyword.control → keyword).
Imported rules are:
- Persisted in the copied theme file under app data
- Applied to
QueryaEditorThemetoken fields (comment, keyword, string, …) - Converted to
syntax_highlightHighlighterThemeforQueryaCodeEditor
Buffers ≥ 8KB are highlighted in a background isolate to keep typing responsive.
- Open Preferences → Appearance
- Choose Theme mode (Dark / Light / System)
- Click Import theme… and select a VS Code
.jsonor.jsoncfile - Select the imported preset from Color preset
The file must include a colors object (required for import). tokenColors are
optional but recommended for editor highlighting.
See also: theme-import.md.
- Add a field to
QueryaWorkbenchTheme(or reuse an existing one) - Map a VS Code key in
kVsCodeColorMap/kSupportedVsCodeColorKeys - Handle the field in
_applyWorkbenchFieldinquerya_theme_from_vscode.dart - Migrate UI surfaces to
context.workbench.<field>instead of hardcoded colors - Add a fixture + unit test under
test/core/theme/
| Area | Location |
|---|---|
| JSONC / manifest | test/core/theme/parser/ |
| Color merge | test/core/theme/parser/vscode_colors_merge_test.dart |
| Fixtures | test/fixtures/themes/ |
| ThemeController | test/core/theme/theme_controller_test.dart |
| Editor highlighting | test/core/editor/ |
Run: flutter test test/core/theme/
Off by default. Enable in Preferences → Appearance → Animate theme changes to
turn on ShadcnApp.enableThemeAnimation.
Manual QA (with animation enabled):
- Toggle dark / light / system — no stuck overlay or wrong brightness on dialogs
- Switch preset (Querya Dark ↔ Light, imported) — sidebars and editor chrome animate smoothly
- Open connection dialog, settings sheet, SQL history — backgrounds readable during transition
- Resize main window while toggling theme — no layout jump or transparent holes
- Import theme while animation on — editor and workbench settle to final colors
| Topic | Status |
|---|---|
Workbench colors import |
Done |
| Preferences UI | Done |
| SQL/JSON syntax highlighting | Done |
tokenColors → highlighter |
Done |
| Theme transition animation | Preferences → Animate theme changes (default off) |
code_forge / LSP editor |
NO-GO for 0.3 — archive/code-forge-evaluation.md |
- theme-import.md — supported
colorskeys and merge behavior - archive/research_theme.md — background research (RU)
- archive/editor-spike-report.md — code editor package evaluation (#48)
- archive/code-forge-evaluation.md —
code_forge+ LSP go/no-go (#52)