NO_COLOR implementation doesn't match the spec
chocolateboy opened this issue · comments
NO_COLOR
is meant to disable color regardless of the value:
All command-line software which outputs text with ANSI color added should check for the presence of a NO_COLOR environment variable that, when present (regardless of its value), prevents the addition of ANSI color.
i.e. all of the following should disable color:
$ NO_COLOR=1 command # ✔
$ NO_COLOR=0 command # ✔
$ NO_COLOR= command # x
$ NO_COLOR="" command # x
But the current implementation expects it to be truthy:
Line 10 in b08ad63
Ah, thanks! Even though it's in bold, I overlooked it 😆 Probably a cross-language thing? FOO=0
feels like it should always be an off-flag.
PR welcome, otherwise I probably won't get to it later today.
//cc @stramel since it might be a surprise to you too
FOO=0 feels like it should always be an off-flag.
Yes, it's an annoying misfeature of the NO_COLOR
spec (no other environment variables I'm aware of behave like it :-)
How did you encounter this? Were you actually trying to do NO_COLOR=
or NO_COLOR=0
in real usage?
Trying to get FORCE_COLOR
to not work like NO_COLOR
in another library...