Skip to content

Latest commit

 

History

History
348 lines (322 loc) · 45.4 KB

index.md

File metadata and controls

348 lines (322 loc) · 45.4 KB
layout
default

NO_COLOR

Last updated: {{ 'now' | date: "%Y-%m-%d" }}

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, some 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 was proposed in 2017:

Command-line software which adds ANSI color to its output by default should check for a NO_COLOR environment variable that, when present and not an empty string (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 export NO_COLOR=1 to their shell's environment and automatically disable color by default in all supported software.

If your software outputs color by default, please consider not doing so. If you insist, please implement this standard to make it easy for your users to disable color and then add your software to this list by submitting a pull request.

If your software does not output color by default, you do not need to bother with this standard.

Example Implementation

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char *argv[])
{
	char *no_color = getenv("NO_COLOR");
	bool color = true;

	if (no_color != NULL && no_color[0] != '\0')
		color = false;

	/* do getopt(3) and/or config-file parsing to possibly turn color back on */
	...
}

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 the same color?

    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 the NO_COLOR environment variable. A user should be able to export NO_COLOR=1 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).

Color libraries supporting NO_COLOR to disable default color output

Software using these libraries to output color inherently support disabling color by default via NO_COLOR.

Software Language Description Date / Version Supported
ansis JavaScript ANSI 256/truecolor styling of text in Node.js 2021-12-28 / 1.2.2
asai OCaml Compiler diagnostics 2023-11-03 / 0.3.0
Bashkit Bash Scripting model and framework 2023-01-27 / 1.2301.32
bitstring Python Efficient and flexible handling of binary data 2024-04-22 / 4.2.0
cfonts Rust, JavaScript Colorful fonts in the console 2022-05-28 / 3.0.0
Cleo Python Beautiful and testable command-line interfaces 2021-01-29 / 1.0.0a1
cli-color JavaScript Colors and formatting 2019-10-09 / 2.0.0
click-extra Python Utilities for Click, the Python CLI framework 2022-04-11 / 2.0.0
ColorDebug C, C++ Colorful command line output macros 2019-02-09
colored Rust Coloring terminal output 2019-01-05 / 1.7.0
Colorette JavaScript Terminal text color & styles 2021-09-17 / 2.0.0
colors-option JavaScript Colors and formatting based on chalk 2021-03-02 / 1.0.0
colour Rust Macros for creating colored console output 2024-05-13 / 2.0.0
console-ansi JavaScript Console coloring and prefixing via Proxy object with ANSI strings 2022-06-14 / 1.3.0
crayon R Colored terminal output 2018-02-08 / 1.5.1
crayon.js JavaScript, TypeScript Terminal styling 2020-04-10 / 1.0.0
crossterm Rust Cross-platform terminal manipulation 2023-08-06 / 0.27
crystal-lang colorize module Crystal Alter text colors and decorations in terminal displays 2022-06-06 / 1.5.0
Dahlia Python Simple text formatting package, inspired by Minecraft 2022-09-24 / 2.0.0
darvil82.terminal-text-formatter Java TextFormatter utility to easily color and format text 2024-03-11 / 2.1.0
Dye Swift Cross-platform terminal styling 2020-06-01 / 0.0.1
Fude JavaScript Terminal text style formatting 2022-06-29 / 3.0.0
Gapotchenko. FX.Console .NET Virtual terminal functionality, console traits, and useful primitives 2020-01-15 / 2020.1.15
gchalk Go Terminal string styling with Windows 10 support 2021-10-06 / 1.1.1
Getopt::EX::Colormap Perl ANSI terminal color and command line option handling 2021-09-27 / 1.25.0
gleamy_lights Gleam->Erlang, Gleam->Javascript Colored console output for Gleam 2024-09-27 / 2.0.2
GNU libtextstyle C Library for styling text output with CSS 2019-08-13 / 0.21
go-ansi Go Easy text formatting 2021-05-18 / 1.4.0
inquire Rust Build interactive prompts 2021-08-29 / 0.0.10
kleur JavaScript Format terminal text with ANSI colors 2020-08-12 / 4.1.0
LogColor Python Color output in log messages 2018-01-24 / 1.2.0
MatthiWare. CommandLineParser C# Command Line Parser 2020-07-21 / 0.3.1
Nano Colors JavaScript Format terminal text with ANSI colors 2021-09-21 / 0.1.0
NetAF .NET Text adventure framework 2024-12-03 / 2.9.6
paint Ruby Terminal colors and effects 2020-02-21 / 2.2.0
pastel Ruby Terminal output styling 2020-07-04 / 0.8.0
Pastel .NET Color console output 2019-03-17 / 1.2.0
php-cli PHP PHP library to build command line tools 2024-12-03 / 1.3.2
PyTermGUI Python TUI framework 2022-03-21 / 4.2.0
rich Python Rich text and beautiful formatting 2022-02-08 / 11.2.0
sgr C++ Stream manipulators for colored text output 2022-02-28
Spectre.Console .NET Create beautiful console applications 2020-07-21 / 0.1.0
System.Console .NET Represents the standard input, output, and error streams for console applications 2021-07-10 / .NET 6
Term::ANSIColor Perl Color output using ANSI escape sequences 2020-01-17 / 5.01
termcolor Rust Cross-platform terminal colors 2020-01-11 / 1.1.0
termcolor Python ANSI color formatting in the terminal 2022-09-11 / 2.0.0
termenv Go Text styling, terminal detection and color conversions 2021-06-24 / 0.9.0
TextOutput Go Control text output using VT100 terminal codes 2019-11-18 / 1.9.1
textus_coloris C Colourised console output 2021-08-16
Warna Lua Terminal text styling 2024-02-11 / 0.1.0
XConsole .NET Coloring, pinning & positioning 2022-04-22 / 1.0.5
{: rules="groups"}

Software directly supporting NO_COLOR to disable color output by default

Software Description Date / Version Supported
alogview Android logcat Filter 2018-10-31
Ammonite Scala Scripting 2017-07-03 / 1.0.0
Ansible IT automation system 2021-04-26 / 2.11.0
Ansible Navigator IT automation interface 2021-10-13 / 1.1.0
Apt Debian Package manager 2021-10-10 / 2.3.11
Archey 4 Python system information tool 2020-09-26 / 4.8.0
Arduino CLI Arduino command line tool 2021-09-02 / 0.19.0
Aurornis Library to simplify command line programs testing 2021-11-16 / 1.2.0
Bashly Bash command line framework and CLI generator 2021-10-26 / 0.6.9
bat cat(1) clone with syntax highlighting and Git integration 2020-10-02 / 0.16.0
beets Music library manager and MusicBrainz tagger 2019-05-30 / 1.4.9
bfs Breadth-first version of the UNIX find command 2019-05-06 / 1.4.1
Bikeshed Spec/Document Processor 2018-07-27 / 0.9
Bloop Compilation/test server for Scala and Java 2018-07-02 / 1.5.3
borgmatic Simple, configuration-driven backup software 2024-03-04 / 1.8.9
buildkit Concurrent, cache-efficient, Dockerfile-agnostic builder toolkit 2022-07-20
Bullseye .NET library for running a target dependency graph 2021-01-01 / 3.6.0
c-ray The small C raytracer 2021-09-24
Cake Cross-platform build automation system with a C# DSL 2021-03-06 / 1.1.0
CakePHP Full stack framework for PHP 2019-12-30 / 4.0.1
Candalf Orchestrate system configuration/setup/management 2022-03-22
cdist Usable configuration management 2020-06-17 / 6.6.0
checkit File integrity tool for Linux and Unix systems 2022-09-08 / 0.5.1
chezmoi Manage dotfiles across multiple machines, securely 2020-05-06 / 1.8.1
Clang C compiler 2023-09-19 / 17.0.1
CliFM The command line file manager 2021-14-12 / 1.7
Clipboard The cut, copy, and paste system for the terminal 2022-12-04 / 0.1.2
Composer PHP package manager 2020-01-14 / 1.9.2
Cras Cras: The Anti-Procrastination Tool 2020-06-05 / 0.1.0
Cronie Cronie cron daemon project 2021-03-19 / 1.6.1
csv2db CSV database loading tool 2019-09-23 / 1.4.0
DataLad Data management and publication multitool 2019-05-23 / 0.11.5
DDraceNetwork Cooperative multiplayer game 2022-02-27 / 5.1
debian-subsystem Use Debian subsystem on other GNU/Linux distributions 2021-11-09
DeepfakeHTTP Web server that uses HTTP dumps as a source for responses 2021-09-17 / 1.0.13
deno Secure TypeScript runtime 2019-02-09 / 0.2.11
Diun Docker Image Update Notifier 2021-05-26 / 4.17.0
elfinfo Utility for displaying ELF information 2020-01-17 / 1.0.1
Elixir Dynamic, functional language 2020-01-27 / 1.10.0
Elvish Powerful scripting language and versatile interactive shell 2024-02-11 / 0.20.0
enum4linux-ng Next generation enum4linux (Windows/Samba enumeration tool) 2020-10-24 / 1.1.0
exa Modern replacement for ls 2021-12-06
eza Modern, maintained replacement for ls 2021-12-06
F2 Safe and fast cross-platform bulk-rename tool 2021-05-04 / 1.5.7
fast-asar A faster implementation of Electron's ASAR archive format 2023-10-17 / 1.0.5
fastlane The easiest way to build and release mobile apps 2020-11-19 / 2.168.0
fd Simple, fast, and user-friendly alternative to find 2020-03-22 / 7.5.0
ffind Rust utility to find files and folders 2018-03-24
forest-arborist Manage a loosely coupled forest of git or hg repositories 2018-04-15 / 1.2.0
fq jq for binary formats 2021-12-03 / 0.0.1
fselect Utility for finding files with SQL-like expressions 2019-03-08 / 0.6.1
fzf A command-line fuzzy finder 2024-06-06 / 0.53.0
gatsby-cli GatsbyJS command line interface 2019-08-05 / 2.20.0
gex Git TUI inspired by Magit 2023-08-05 / 0.6.1
gh GitHub’s official command line tool 2020-04-22 / 0.7.0
git-delete-merged-branches Command-line tool to delete merged Git branches 2020-06-29 / 1.2.0
git-subline-merge Git merge driver for resolving conflicts 2019-07-27
git-task Local-first task manager for git repositories with remote sync 2024-10-02 / 0.1.1
GNU gdb The GNU Debugger 2023-09-29 / 14.1
gocryptfs Encrypted FUSE filesystem 2021-12-11 / 2.3
gojq Pure Go implementation of jq 2020-03-20 / 0.10.0
gopass Password store for teams 2018-06-06 / 1.8.0
gplaces Simple terminal based Gemini client 2022-06-05 / 0.16.19
GraalVM Native Image Compile Java applications ahead-of-time into binaries 2022-02-28 / 22.1.0
gwen Automation and robotics for Gherkin 2021-11-16 / 3.0.0
h5glance HDF5 file viewer 2024-11-19 / 0.9
Hajime Advanced Minecraft server wrapper 2022-02-27
Homebrew Package manager for macOS 2018-02-27 / 1.5.5
Hono JavaScript framework built on Web Standards 2024-03-12 / 4.1.0
Hspec Testing framework for Haskell 2021-05-12 / 1.8.1
htmltest Tests generated HTML for issues 2021-01-16 / 0.14.0
Hugo Framework for building websites 2022-06-16 / 0.101.0
Hurl Run and test HTTP requests with plain text and curl 2022-09-13 / 1.7.0
hx Futuristic take on hexdump, made in Rust 2020-11-22 / 0.4.0
inary Package manager for SulinOS 2021-10-18
irb Official Ruby REPL 2021-06-21 / 1.3.6
jc Convert output of command-line tools and file-types to JSON 2021-12-07 / 1.17.4
jello Filter JSON and JSON Lines data with Python syntax 2021-12-08 / 1.5.0
jq Lightweight and flexible command-line JSON processor 2023-09-06 / 1.7
jqjq jq implementation of jq 2024-02-07
KBSecret Secret manager backed by Keybase and KBFS 2018-04-13 / 1.4.0
kitten Tiny multi-server automation tool 2018-06-06 / 0.2.14
konch Python shell/REPL configuration tool 2019-01-19 / 4.0.0
lakeFS Manage data as code using Git-like operations 2023-07-10 / 0.109.0
lat Fast file viewer and text formatter 2023-04-20 / 0.3.2
lbt Friendly tools for interacting with the LBRY network 2022-03-31 / 2.1.2
lc Multi-dimensional, abbreviating ls/file lister in Nim 2019-11-18 / 0.9.1
LicensePlist License list generator for Apple developer 2022-09-20 / 3.23.3
Lintian Friendly packaging advice for Debian contributors 2021-12-12 / 2.114.87
lr File list generator 2018-01-29 / 1.5.1
lsd The next gen ls command 2022-01-16 / 0.21.0
mblaze Unix utilities to deal with Maildir 2018-01-29 / 1.2
meli Terminal mail client in Rust 2019-01-27 / 0.7.2
Meltano Data ingestion, transformation, and management 2022-11-08 / 2.9.0
Microfetch Very fetch tool in Rust for NixOS systems 2024-12-19 / 0.4.3
Middleman Ruby-based static site generator 2019-02-18 / 5.0.0
mmCEsim Millimeter Wave Channel Estimation Simulation 2023-03-31 / 0.2.1
Modules Dynamic modification of one's environment 2020-04-07 / 4.5.0
mu Maildir indexer/searcher 2019-02-02 / 1.8.10
Nette Tester Testing library for PHP 2020-08-03 / 2.3.3
newsraft Feed reader for terminal 2022-08-14 / 0.8
NGLess Domain specific language for bioinformatics 2018-10-29 / 1.5.0
Nix The purely functional package manager 2021-11-01 / 2.4.0
nnn File manager 2020-04-05 / 4.6
noether Unit catalogue and calculator for Python 2023-08-02 / 1.1
nostt Teletext reader 2023-08-03 / 1.3
Nox Flexible test automation 2019-04-11 / 2019.4.11
npm Package manager for JavaScript 2018-03-24 / 5.8.0
nvh Node Version Helper 2018-08-04 / 4.1.0
o Small, fast, and limited text editor 2020-01-06 / 2.13.2
OCaml compiler The OCaml programming language compiler 2022-03-28 / 4.14.0
Octopus Deploy CLI Command Line Interface for Octopus Deploy 2022-11-23 / 0.6.0
opass Offer password suggestions 2021-06-12 / 0.9.1
ouch Painless CLI compression and decompression 2021-09-17 / 0.3.1
Pacstall AUR-inspired package manager for Ubuntu 2023-02-27 / 3.7.0
picocli Tiny Java command line interface 2019-01-05 / 3.9.0
pipewire PipeWire multimedia server 2021-03-13 / 0.3.24
Planck Stand-alone ClojureScript REPL 2019-05-19 / 2.23.0
Poetry Dependency management and packaging in Python 2021-05-21 / 1.2.0a1
PowerShell Shell and scripting language 2021-11-08 / 7.2.0
procs Process and system query and formatting 2019-11-18 / 0.4.0
pulumi Programming-language-based IaC framework 2018-06-04 / 0.14.3
PyDERASN Python ASN.1 DER/CER/BER library 2018-02-14 / 3.1
pytest Python testing framework 2020-07-28 / 6.0.0
Python Python REPL, tracebacks and doctest output 2024-05-08 / 3.13.0b1
ripgrep Line-oriented search tool 2020-01-11 / 12.0.0
rsmodules Manage one's environment by the use of modulefiles 2018-10-09 / 0.7.3
rsyncy Status/progress bar for rsync 2023-06-30 / 0.2.0
Ruff Python linter written in Rust 2023-08-09
Scipion CryoEM and CryoET image processing workflow engine 2022-07-07 / 3.0.22
ShellSpec Full-featured BDD unit testing framework for shell scripts 2020-06-21 / 0.25.0
shuffle Command line music player 2022-02-03 / 1.9.1
sjasmplus Z80/Z80N/GameBoy cross-assembler 2022-06-14 / 1.20.0
smenu Terminal selection filter 2018-02-05 / 1.0.0
Snow Testing library for C 2018-01-24 / 2.3.2
soupault Static website generator based on HTML rewriting 2021-07-19 / 3.0.0
Sphinx The Sphinx documentation generator 2022-03-28 / 4.5.0
sqlfmt Autoformatter for dbt SQL 2021-11-05 / 0.1.0
Symfony PHP framework and reusable components 2019-11-21 / 4.4.0
taoup Fortune implementation 2018-09-10 / 1.19
Tarantool In-memory computing platform 2021-10-19
TeaISO Live ISO generation tools 2021-10-22
tealdeer TLDR pages client 2020-09-03 / 1.4.0
Telescope Gemini browser 2021-06-27 / 0.3
tio A simple serial device I/O tool 2024-03-06
tree Recursive directory listing command 2022-12-26 / 2.1.0
Tree-Sitter A parser generator tool and an incremental parsing library 2024-05-05 / 0.22.6
TreeViewer Phylogenetic tree visualisation software 2021-02-19 / 1.0.0
Trunk Recorder Radio recorder for P25, SmartNet, and conventional systems 2023-12-02 / 4.7.0
tsfm Light TUI file manager 2023-07-19 / 2.4.0
twa Tiny web auditor with strong opinions 2018-11-15 / 1.1.0
txtnish Twtxt microblogging client 2018-08-31
ugrep File pattern searcher 2024-04-03 / 5.1.2
undertime Timezone coordination tool 2018-06-06
UnrealIRCd IRC Server 2023-03-11
UPX The Ultimate Packer for eXecutables 2023-10-26 / 4.2.0
whence Print URL a file was downloaded from 2020-06-20 / 0.9.2
woob Command-line applications to interact with many websites 2021-05-13 / 3.1
xh Friendly and fast tool for sending HTTP requests 2021-02-28 / 0.8.0
xidoc Consistent and powerful markup language 2023-01-09 / 2023.1.9
xplr File manager 2021-04-15 / 0.4.4
yewtube Terminal YouTube client 2023-04-22
yt-dlp Video downloader 2023-11-20
zf Command-line fuzzy finder prioritizing matches on filenames 2022-07-02 / 0.5
zig Zig compiler 2021-12-20 / 0.9.0
zoxide Smarter cd command 2020-03-05 / 0.1.0
zypper openSUSE package manager 2022-06-15 / 1.14.53
{: rules="groups"}

Disabling color in software not supporting NO_COLOR

{:.two_col}

Software Method
Ammonite amm --color false (Docs)
Arcanist arc --no-ansi COMMAND (Docs)
Bundler bundle COMMAND --no-color (Docs)
Chalk export FORCE_COLOR=0 (Docs)
CMake Set CMAKE_COLOR_DIAGNOSTICS to OFF (Docs)
Cocoapods pod COMMAND --no-ansi (Docs)
FFmpeg export AV_LOG_FORCE_NOCOLOR=true (Docs)
GCC export GCC_COLORS= or -fno-diagnostics-color (Docs)
Git git config --global color.ui false (Docs)
GoAccess goaccess --no-color (Docs)
GStreamer export GST_DEBUG_NO_COLOR=true or --gst-debug-no-color (Docs)
luacheck luacheck --no-color (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
Puppet puppet agent --color false (Docs)
Radare radare2 -e scr.color=0
RSpec export SPEC_OPTS=--no-color
Ruby (tests) export RUBY_TESTOPTS=--color=never
The Silver Searcher ag --nocolor (Rejected NO_COLOR Request)
Thor export THOR_SHELL=Basic (Docs)
util-linux touch /etc/terminal-colors.d/disable (Docs)
Vim vim '+set t_Co=0'
zellij zellij --no-formatting (GitHub Issue #3057)
{: rules="groups"}