Respect NO_COLOR environment variable
- [X] I have read through the manual page (
man fzf) - [X] I have the latest version of fzf
- [X] I have searched through the existing issues
Info
- OS
- [X] Linux
- [ ] Mac OS X
- [ ] Windows
- [ ] Etc.
- Shell
- [X] bash
- [X] zsh
- [ ] fish
Problem / Steps to reproduce
Running fzf with the NO_COLOR environment variable should disable ANSI color output as described by no-color.org.
@Seirdy, fzf is listed on that website with a way to have colors disabled:
From the man page:
--color=[BASE_SCHEME][,COLOR:ANSI]
Color configuration. The name of the base color scheme is followed by custom color mappings. Ansi color code of -1 denotes terminal default foreground/background color. You can also specify
(...)
bw No colors (equivalent to --no-color)
Isn't this enough for your use case?
@LuRsT I am aware that it is possible to use this option and to make it the default by including it in $FZF_DEFAULT_OPTS; however, this doesn't address the problem outlined at https://no-color.org:
Unfortunately, every new piece of software seems to have a different way of disabling colored text
I believe that FZF shouldn't require this additional configuration if the $NO_COLOR environment variable is set. Following this standard will reduce the burden of looking up how each CLI tool disables color output.
I guess that'd be @junegunn 's call. What do you think?
It is not clear to me that the protocol is, and will be, widely agreed upon. The linked page shows that only a small number of tools, most of them I've never heard of, decided to have implemented it. There is even a competing standard that has existed over the years. I've also noticed there are some projects implementing FORCE_COLOR instead of or along with NO_COLOR.
For now, I don't see a compelling reason for fzf to implement the protocol. I'd like to revisit this after NO_COLOR has garnered wide adoption.
Currently, the NO_COLOR standard seems to be more popular; it is accepted by
popular software such as NPM, Homebrew, Gatsby, Symfony, and Elixir.
Furthermore, these standards aren't mutually exclusive; all that's necessary is an order of precedence. That being said, I understand if this issue needs to be put on hold until one standard receives wider adoption.