Repository navigation
feat(tui): derived syntax palette with optional theme syntax block (U4) - #103
Merged
lg2m merged 1 commit intoSep 21, 2026
Merged
Conversation
Slice U4 of docs/plans/tui-redesign.md (ENG-850), stacked on U9. Palette gains eight syn_* roles derived from the declared roles (constant is brand blended toward text; nothing maps to error) and an optional theme `syntax` block overrides any subset, validated per field with a typed ConfigError variant. Eleven shipped themes carry upstream token colors; ember and ink derive. Captures add punctuation (muted), operator and parameter (text). Highlight jobs now run under the requesting thread's palette, fixing themed panels that came back in qq colors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
U4: derived syntax palette with optional theme
syntaxblockSpec: docs/plans/tui-redesign.md#s5-syntax-palette (decision D10) Linear: ENG-850 (parent ENG-843)
Stacked on #101 (U9). Review the top commit only until #101 merges.
What changed
qq-tuiPalettegains eightsyn_*roles derived from the declared roles: keyword → brand, function → accent, type → warning, string → success, constant → brand softened toward text (a const 2:1 channel blend; no role maps toerrorany more), comment → muted italic, property → text, punctuation → muted.render::code_*read them;code_punctuation()added.HIGHLIGHT_CAPTURESaddsoperator,punctuation.bracket,punctuation.delimiter,variable.parameter.qq-configtheme documents accept an optionalsyntax: ( keyword: .., function: .., type: .., string: .., constant: .., comment: .., property: .., punctuation: .. )block: every field optional,deny_unknown_fields, colors validated with the same alias/literal/cycle rules as the eight roles. Malformed input →ConfigError::InvalidThemeSyntax { origin, role: SyntaxRole, reason: ThemeColorFault }.syntaxblock from their upstream token colors (catppuccin, dracula, everforest, gruvbox, kanagawa, monokai, nord, onedark, rose-pine, solarized, tokyonight; sources listed in the ledger receipt). Fields a palette does not define are omitted so the derived default applies.ember,ink: no block.src/main.rs) appliessyntaxoverrides after derivation.view/highlight.rsspawn_blockingworkers had no active palette, so highlighted panels came back inqqcolors under every theme.requestnow capturestheme::active()and activates it on the worker; regression test.#[inline(never)]onhighlighted_code_lines: the capture-table growth let it inline intolayout_code_paneland cost +7 % onstreaming_run_on_32kb; bisected with a size-only padded parent (427 µs) vs captures-only (459 µs).How verified
cargo test --workspacegreen: qq-tui 280 → 285, qq-config 88 → 89, root 169 → 170; goldens unchanged (plain text). fmt, clippy-D warnings.error; punctuation muted / operator+param text on a highlighted snippet; every bundled grammar highlights a bracketed snippet with the extended captures;syntaxblock absent / full / subset / empty / bad literal / unknown alias / cycle / unknown field / non-block value; every shipped theme loads and its block validates; root test that overrides land and everything else equals derivation; highlight worker uses the active theme.Measurements (
target/qq-perf/tui-U4-2026-09-20/, pinned core)resize_ultra_480x120+8 % (110 → 118); ~3 µs reproduces on a parent padded by 32 bytes alone (Palette growth), the remainder appears to be code layout. Not a named gate; recorded.Docs
docs/design/theme.md:syntaxblock, derived defaults, validation; the v1 out-of-scope bullet removed. Ledger receipt.Compatibility