Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From the Clipboard "User Experience Manifesto" [1]:

    Clipboard does not have any configuration. Note that I said "have," not
    "use." That's because Clipboard cleverly picks up on certain settings that
    are present everywhere they're possibly used. One such setting is
    NO_COLOR. NO_COLOR is an unofficial standard to specify a global disabling
    of color output by software. If the NO_COLOR environment variable is
    defined, then programs should not display color.
I'm unaware of many programs that actually respect $NO_COLOR. Certainly `ls` and `grep`, the two programs I use the most which display colored output, don't respect that environment variable. `ag` doesn't respect it either. In fact, the only program I use on a semi-regular basis which respects $NO_COLOR is `fd`. All the rest expect a `--no-color` command line parameter to disable colorized output. Given that, I'm wondering why the authors chose to control output colorization with an environment variable, rather than a command line argument.

[1]: https://github.com/Slackadays/Clipboard/wiki/User-Experience...



Neither ls nor grep output color by default. Most distributions have a bashrc script that sets aliases like:

  alias grep='grep --color=auto'
  alias ls='ls --color=auto'
Ls and grep are defined such that you can specify --color multiple times and the last one will take effect, allowing you to disable coloring while still using the alias that enables it. The FAQ at no-color.org states:

> User-level configuration files and per-instance command-line arguments should override $NO_COLOR

So, it looks like like ls and grep respect it fine with just their default behaviour.

As an aside, at least on my system, ls and grep do not recognize --no-color. I need to specify it with --color=never.


Origin of NO_COLOR [1] and relevant discussion on HN [2]

[1]: https://no-color.org/

[2]: https://news.ycombinator.com/item?id=30483417




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: