Disable colors if NO_COLOR env var is present and nonempty#5004
Merged
egmontkob merged 1 commit intoMidnightCommander:masterfrom Feb 23, 2026
Merged
Conversation
zyv
approved these changes
Feb 6, 2026
Member
zyv
left a comment
There was a problem hiding this comment.
Given the evolution of the NO_COLOR project, I wouldn't object on principle.
5a01181 to
ac6bfed
Compare
Contributor
Author
|
Friendly pings @mc-worker Review please @RauliL Any feedback? I'll submit on your behalf in about a week if I don't hear back from you. |
Contributor
|
@egmontkob I'm OK with this. |
ac6bfed to
8fa679b
Compare
Contributor
Author
|
I realized I did not add documentation, so added now. We don't have a dedicated "env vars" section and I didn't want to introduce one, so I've added it to the description of the |
Member
I'm still fine with that. |
Contributor
|
mc-worker
approved these changes
Feb 22, 2026
Disable colors when environment variable `NO_COLOR` is present and nonempty, according to the "standard" described in http://no-color.org/ The command line option --color may override this. Signed-off-by: Egmont Koblinger <egmont@gmail.com>
8fa679b to
00b6df1
Compare
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.
Proposed changes
Disable colors when environment variable
NO_COLORis present and nonempty, according to the "standard" described in http://no-color.org/Checklist
git commit --amend -smake indent && make check)This was already submitted a long time ago, at MidnightCommander/mc-old#133. Then it was closed without mc devs expressing their opinions.
Since then, a couple of things have changed:
NO_COLOR is still a somewhat controversial initiative, several people have expressed that it should have been done differently, but it's definitely gaining traction. With about 4 lines of source code, why not join them?
@RauliL I've prepared the change in your name as the original author. I had to modify two things: the handling of the empty value, and moving the code elsewhere so that
--colorcan override it. Neither were your fault: the standard changed since then.It's signed-off-by me. Not sure how it should be done ideally, but I don't think I should add someone else's name there. Please let me know if you have any comment or preference; maybe the cleanest would be if you could take back full ownership and re-submit the PR fully under your name?