Last updated: 2018-02-14

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
crayon R package for colored terminal output 2018-02-08
Homebrew Package manager for macOS 2018-02-12
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
PyDERASN Python ASN.1 DER library 2018-02-14
smenu Terminal selection filter 2018-02-05
Snow Testing library for C 2018-01-24

Disabling color in software not supporting NO_COLOR

Software Method
Ansible export ANSIBLE_NOCOLOR=true (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).