fix(ui): honour CLICOLOR and CLICOLOR_FORCE - #783
Merged
Conversation
CLICOLOR_FORCE now emits colour even when stderr is not a terminal - the knob needed when piping into less -R or asking a CI job for ANSI - and CLICOLOR=0 turns colour off. NO_COLOR stays an unconditional veto that nothing overrides. The decision is now a named, pure precedence table instead of a fused env-read-and-TTY-probe expression, so every combination is directly testable and the ordering is a documented contract.
This was referenced Jul 26, 2026
indaco
added a commit
that referenced
this pull request
Jul 27, 2026
CLICOLOR_FORCE now emits colour even when stderr is not a terminal - the knob needed when piping into less -R or asking a CI job for ANSI - and CLICOLOR=0 turns colour off. NO_COLOR stays an unconditional veto that nothing overrides. The decision is now a named, pure precedence table instead of a fused env-read-and-TTY-probe expression, so every combination is directly testable and the ordering is a documented contract. (cherry picked from commit bf131a7)
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.
Description
malt honoured
NO_COLORand nothing else, so there was no way to ask for colour - the knob you need when piping intoless -Ror when a CI job wants ANSI in its log.CLICOLOR_FORCEnow emits colour even when stderr is not a terminal, andCLICOLOR=0turns it off.NO_COLORstays an unconditional veto, matching howmt tuihas always treated it.The decision is now a named, pure precedence table instead of one fused env-read-and-TTY-probe expression, so the ordering is a tested contract rather than an accident of how a line was written. Colour is a tri-state (
auto/always/never) because "colour regardless of TTY" is not something a TTY probe can express.With none of the three variables set, behaviour is unchanged.
Related Issue
Notes for Reviewers
NO_COLORbeatsCLICOLOR_FORCE, pinned by a named test.NO_COLORdisables on presence alone, soNO_COLOR=andNO_COLOR=0also disable. That diverges from no-color.org and is kept so existing behaviour cannot regress - flagged in a comment and pinned by a test, not changed here.This is part 1 of 3 in a stack made with GitButler: