Repository navigation
feat(tui): themes (#463) - #569
Merged
Merged
Conversation
Add a Theme (role -> style) to tole-tui with built-in default, light and mono themes, per-role color overrides from the user config, TOLE_THEME and NO_COLOR. Themes cannot set backgrounds or conceal text, critical roles stay non-dim and bold, a project config cannot set the theme, and an invalid value falls back to default with a startup note.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
…UI (#463) A build without the tui feature cannot validate a theme, so config check now says the theme is not validated instead of reporting an effective value or a verdict. The tests that assume the TUI are gated on the feature.
Slash commands are ignored while a turn runs, so a /quit sent right after the provider text appeared, before the turn settled, was dropped and the process never exited: wait_exit timed out and returned None. This failed the Test job of the themes PR although the change is unrelated. Wait for the idle footer first, like the other e2e tests do.
ajianaz
added a commit
that referenced
this pull request
Nov 11, 2026
[tui.keys] in the user config rebinds ten convenience actions (tool output, reasoning, model picker, cycle model, cycle thinking, newline, queue follow-up, pop queue, history) to a key spec or a list; the default keymap is the keys the TUI always had. y, n, Esc, Ctrl+C, Enter, Backspace, Tab and every bare character are never rebindable, and at an approval prompt only y, n, Esc and Ctrl+C act whatever the keymap says. A project config cannot set keys (ignored with a warning), and an invalid keymap falls back to the default with one startup note. Closes #463 with #567, #568 and #569.
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.
What
Part 3 of #463 (themes). Part of #463; the keybinding config remains.
The TUI gets a
Theme(semantic role -> ratatuiStyle) with three built-in themes (default,light,mono),NO_COLORsupport, and optional per-role color overrides in the user config.Why
Hardcoded colors were unreadable on light terminals (yellow, white, cyan) and ignored
NO_COLOR. A theme also decides how the approval prompt looks, so the design is built so a theme can never hide text and a cloned repository can never control it.Changes
tole-tui: newtheme.rs(20 roles, built-ins, color/spec parser, safety rules).render.rsreads every style fromApp's theme (noColor::/Modifier::left there).TuiHostgets two defaulted methods,theme()andstartup_note();App::with_theme.tole-tuistill reads no file or env.defaultreproduces today's look exactly (pinned by a test).light: no yellow/white/cyan text, blue tools/code, dark amber notes and approval.mono: no colors, only bold/dim/italic/underline.TOLE_THEME>[tui] themein the user config > non-emptyNO_COLOR(->mono) >default. Overrides:[tui.colors] role = "<color> [bold] [italic] [underline] [dim]", with a color name,0-255, or#rrggbb. An override replaces the role's whole style. No theme file format (it would add a loader and a second schema for no gain).approvalandnoteare critical (never dim, custom styles forced bold); a color is rejected only if it can never be valid; any invalid value falls back todefaultwith one startup note naming the key and the problem.config::layereddrops a project config's[tui]table; startup prints onewarning: ignoring tui in project config ...andtole config checkmarks the project keysIGNOREDand shows the effective theme with its source (andINVALIDfor a bad value).tuifeature): theme validation needstole-tui, so a build without it cannot know whether a theme is valid.tole config checkthere prints(not validated: this build has no TUI ...)fortui.themeandtui.colorsinstead of an effective value or a verdict; the tests that need the TUI are gated on the feature (the project-boundary and precedence tests do not need it and run in every profile).test(tui): wait for idle before /quit in the escape-sequence e2e):tui_never_passes_escape_sequences_from_provider_textsent/quitright after the provider text appeared. Slash commands are ignored while a turn runs, so a/quitsent before the turn settled was dropped, the process never exited, and theTestjob failed (Noneinstead ofSome(0)). The test now waits for the idle footer first, like the other e2e tests. The test is ondevelopunchanged by this PR, so the commit can be taken out on its own.docs/tui.md(themes section, no/themebecause a live switch cannot restyle the append-only scrollback), README status/key/env rows,docs/epics.md,docs/threat-model.md.Deviations from the design, with reasons:
approvalandnoteare NOT bold (today they are yellow, not bold); making them bold would change the default look. The "critical = bold" rule is enforced forlight,monoand every custom override; "never dim" holds in every theme, default included.NO_COLORset, an explicit colored theme still prints without color: crossterm 0.29 itself drops color escapes whenNO_COLORis set and non-empty. Explicit theme still wins in selection and inconfig check; bold/dim/underline stay.pickerrole is plain indefault. The brief's "picker highlight" maps to that role.[tui](wrong type, unknown key) are hard config errors like any key; bad values are soft.Testing
cargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings: clean.cargo test --workspace: 1298 passed, 0 failed.no-mcpCI commands:cargo check -p tole-cli --no-default-features,cargo test -p tole-cli --no-default-features(397 passed, 0 failed),cargo check ... --features shell-tools,cargo clippy ... --features shell-tools -- -D warnings,cargo test ... --features shell-tools(505 passed, 0 failed),cargo check -p tole-core --no-default-features --tests: all green. The first push failedno-mcp profilebecause a config-check test assertedINVALIDin a build that cannot validate; fixed as described under Changes.cargo fmt --all -- --checkandcargo clippy -p tole-cli --all-targets -- -D warningsclean, and the wholetui_e2efile (13 tests) passed 5 runs in a row. The flake depends on timing, so five green runs make it likely, not certain, that it is gone.monohas no fg/bg,lightdiffers where it matters, parsing (names, indexed,#rrggbb), errors name the role, no background/conceal producible, critical roles never dim and bold in custom styles.NO_COLORignored), project theme ignored inlayeredand in resolution, invalid values fall back with the note,config checkoutput, e2e with the real binary for the project warning,INVALID, and a bad user theme not aborting a command.tui_e2e.rs,tuifeature only):TOLE_THEME=monoandNO_COLOR=1produce no SGR color sequence (ESC[3Xm,ESC[9Xm,ESC[38;...), the default andlightthemes still do, an unknown theme shows one note;tui_never_passes_escape_sequences_from_provider_textstill passes.corais not installed here; I reviewed the staged diff by hand (precedence, project-config boundary, parsing, error paths). The CI Cora Review is the gate.