Repository navigation
feat(tui): respect NO_COLOR for banner and status output - #970
Open
delaysystem wants to merge 2 commits into
Open
delaysystem wants to merge 2 commits into
delaysystem wants to merge 2 commits into
Conversation
Honor the NO_COLOR convention (https://no-color.org): when set to a non-empty value, print the banner, status tags and open/closed port lines without color codes. Gives users on light terminal themes (issue bee-san#778) and tools that cannot parse escapes a readable plain output. The colored crate already honors NO_COLOR itself; the tui-level check keeps that guarantee if the color backend changes.
The six macro arms and two banner blocks each repeated the same colors_enabled if/else, tripping Sonar's duplication gate (17.4%). Status macros now call tui::print_tagged, banner blocks call tui::print_colored_or_plain. No behavior change.
|
This branch has not been deployed
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.



Relates #778 (banner unreadable on light terminals).
Honors NO_COLOR (https://no-color.org): when set and non-empty, the banner gradients, status tags, and port colors print without escape codes. Tags stay, codes go. Unset or empty keeps colors.
Note: likely merge conflict with #961's color unification. Different goal, and this survives that migration since colorful/ansi_term don't honor NO_COLOR themselves.
Tests: 2 new unit tests over a pure helper (env reads can't be safely mutated under parallel tests) plus full
just teststeps green (cargo test, both clippy gates deny-warnings, fmt, doc). Functional check on a no-network run: ESC byte counts 430 (unset) / 0 (NO_COLOR=1) / 430 (empty).