Fixes #5509 branch color getter invoker now applies Active attribute#5510
Merged
YourRobotOverlord merged 6 commits intoJun 21, 2026
Merged
Conversation
add color getter delegate to demonstrate issue
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes TreeView branch rendering when a custom ColorGetter is used by ensuring the unfocused-but-selected state uses the Active attribute, and updates the UICatalog scenario/docs to demonstrate and explain the behavior.
Changes:
- Update TreeView branch draw logic to use
Scheme.Activefor selected branches when the TreeView is unfocused. - Expand
TreeView<T>.ColorGetterXML docs to clarify whichSchemeroles are consumed. - Extend the UICatalog TreeView scenario with a toggleable custom color delegate.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Terminal.Gui/Views/TreeView/TreeViewT.cs | Improves ColorGetter documentation, including how Normal/Focus/Active are used. |
| Terminal.Gui/Views/TreeView/Branch.cs | Fixes selection coloring with ColorGetter by applying Active when the TreeView lacks focus. |
| Examples/UICatalog/Scenarios/TreeUseCases.cs | Adds a scenario toggle to demonstrate ColorGetter-based per-node coloring. |
Comments suppressed due to low confidence (1)
Terminal.Gui/Views/TreeView/Branch.cs:219
- When a
ColorGetteris set but returnsnullfor a given model, the code currently setsmodelColor = new Attribute ()(white/black). This contradicts theColorGetterXML docs ("null to use the default tree view scheme") and causes theme-inconsistent colors for nodes that intentionally fall back to the default scheme. Keep the existingmodelColor(initialized fromtextColor) whenmodelSchemeisnull.
: modelScheme.Normal;
}
else
{
modelColor = new Attribute ();
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…YourRobotOverlord/Terminal.Gui into fix-Branch-color-getter-invoker
tig
approved these changes
Jun 21, 2026
This was referenced Jun 23, 2026
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.
Fixes
Activeattribute on TreeView Branch #5509Proposed Changes/Todos
Activeattribute.Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)Before
After