NO_COLOR

Last updated: 2018-09-10

An increasing number of command-line software programs output text with ANSI color escape codes by default. While some developers and users obviously prefer seeing these colors, many users don’t. Unfortunately, every new piece of software seems to have a different way of disabling colored text output and some software has no way at all.

Accepting the futility of trying to reverse this trend, an informal standard is hereby proposed:

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.

By adopting this standard, users that prefer to have plain, non-colored text output can set one environment variable in their shell to have it automatically affect all supported software.

This website will document which software has adopted this standard and when support was added. For software that has not or will not adopt this standard, an attempt will be made to document how to otherwise disable color.

To add software to this site, clone this site’s Git repository and submit a pull request.

Software supporting NO_COLOR to disable default color output

Software Description Version/Date Supported
Bikeshed Spec/Document Processor 2018-07-27
Bloop Compilation/test server for Scala and Java 2018-07-02
crayon R package for colored terminal output 2018-02-08
ffind Rust utility to find files and folders 2018-03-24
gopass Password store for teams 1.8.0
Homebrew Package manager for macOS 1.5.5
KBSecret Secret manager backed by Keybase and KBFS 1.4.0
kitten Tiny multi-server automation tool 0.2.14
LogColor Python library for coloring output in log messages 2018-01-24
lr File list generator 2018-01-29
mblaze Unix utilities to deal with Maildir 2018-01-29
npm Package manager for JavaScript 5.8.0
pulumi Programming-language-based IaC framework 0.14.3
PyDERASN Python ASN.1 DER library 2018-02-14
undertime Timezone coordination tool 2018-06-06
smenu Terminal selection filter 2018-02-05
Snow Testing library for C 2018-01-24
taoup Fortune implementation 2018-09-10
txtnish Twtxt microblogging client 2018-08-31

Disabling color in software not supporting NO_COLOR

Software Method
Ansible export ANSIBLE_NOCOLOR=true (Docs)
Arcanist arc --no-ansi COMMAND (Docs)
Bundler bundle COMMAND --no-color (Docs)
Clang -fno-color-diagnostics (Docs)
Cocoapods pod COMMAND --no-ansi (Docs)
fzf fzf --color=bw or export FZF_DEFAULT_OPTS=--color=bw (Docs)
GCC export GCC_COLORS= or -fno-color-diagnostics (Docs)
Git git config --global color.ui false (Docs)
Lynx lynx -nocolor (or show_color=never in .lynxrc)
Mercurial hg --color=never (or Docs for .hgrc)
Midnight Commander mc --nocolor
Packer export PACKER_NO_COLOR=true
Ripgrep rg --color=never
RSpec export SPEC_OPTS=--no-color
Ruby export RUBY_TESTOPTS=--color=never
The Silver Searcher ag --nocolor (Pending NO_COLOR PR)
Thor export THOR_SHELL=Basic (Docs)
util-linux touch /etc/terminal-colors.d/disable (Docs)
Vim vim '+set t_Co=0'

Frequently Asked Questions

  1. Why not just set $TERM to dumb or xterm without color support? Or change all color definitions in the terminal to print black?

    The terminal is capable of color and should be able to print color when instructed. NO_COLOR is a hint to the software running in the terminal to suppress addition of color, not to the terminal to prevent any color from being shown.

    It is reasonable to configure certain software such as a text editor to use color or other ANSI attributes sparingly (such as the reverse attribute for a status bar) while still desiring that other software not add color unless configured to. It should be up to the user whether color is used, not the software author.

  2. How should configuration files and command-line arguments be processed in the presence of $NO_COLOR?

    User-level configuration files and per-instance command-line arguments should override $NO_COLOR. A user should be able to export $NO_COLOR in their shell configuration file as a default, but configure a specific program in its configuration file to specifically enable color.

    This also means that software that can add color but doesn’t by default does not need to care about $NO_COLOR, because it will only ever be adding color when instructed to do so (as it should be).