feat: configurable semantic role colors in themes and config - #235
Open
wowi42 wants to merge 1 commit into
Open
Conversation
Extend the theme/config color system (item from gi-dellav#186) so semantic conversation roles can be recolored instead of using the hardcoded palette. Both theme files and the [colors] config section accept a roles map: "roles": { "agent": "#cdd6f4", "error": "#f38ba8", "tool": "#f9e2af", "permission": "#cba6f7" } - New ui::roles registry holding the overrides; BlockStyle::color() resolves through it and falls back to the historical palette. - Known roles: user, agent, reasoning, tool, tool_result, error, system, welcome, permission, plain. Unknown role names and unparsable colors are skipped with a warning. - Applying a theme/config without a roles map resets to defaults, so switching themes drops the previous theme roles. - Documented in docs/CONFIG.md with an example.
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.
Summary
Implements item 3 of the "Input and pickers" section of #186: "Extend the theme/config system to map semantic roles (agent, error, tool, permission) to configurable colors."
Semantic conversation roles are now recolorable from both theme files and the
[colors]config section, via a newrolesmap:{ "colors": { "chat_background": "#1e1e2e", "roles": { "agent": "#cdd6f4", "error": "#f38ba8", "tool": "#f9e2af", "permission": "#cba6f7" } } }Changes
src/ui/roles.rs: global registry of role color overrides with the historical palette as defaults.BlockStyle::color()resolves through it, so all feed blocks — and legacywrite_line(color)call sites that map to roles viastyle_from_color— pick up themed colors automatically.user,agent,reasoning,tool,tool_result,error,system,welcome,permission,plain. Colors are parsed with the existingparse_color(named colors +#rrggbb).tracingwarning, never breaking rendering. Applying a theme or config without arolesmap resets to the default palette, so switching themes doesn't leak the previous theme's roles.docs/CONFIG.mdcolors section documentsroleswith an example.Verification
cargo test(717 passed),cargo test --no-default-features(602 passed),cargo clippy --all-features -- -D warningsandcargo clippy --no-default-features -- -D warnings— all clean.Refs #186