Skip to content

feat(tui): respect NO_COLOR for banner and status output - #970

Open
delaysystem wants to merge 2 commits into
bee-san:masterfrom
delaysystem:auto-batch1/s1-no-color-support
Open

delaysystem wants to merge 2 commits into
bee-san:masterfrom
delaysystem:auto-batch1/s1-no-color-support

Conversation

@delaysystem

@delaysystem delaysystem commented Nov 8, 2026 •

Copy link
Copy Markdown

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 test steps 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).

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.
@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant