diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index d53416498c..5fbd6d7261 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -456,6 +456,12 @@ check_colors (NmcColorOption color_option, return FALSE; } + if ( color_option == NMC_USE_COLOR_AUTO + && g_getenv ("NO_COLOR")) { + /* https://no-color.org/ */ + return FALSE; + } + term = g_getenv ("TERM"); if (color_option == NMC_USE_COLOR_AUTO) { diff --git a/man/nmcli.xml b/man/nmcli.xml index 203337693c..694ffc3aba 100644 --- a/man/nmcli.xml +++ b/man/nmcli.xml @@ -129,6 +129,9 @@ terminal-colors.d5. Please refer to the section for a list of color names supported by nmcli. + If the environment variable NO_COLOR is set (to any value), + then coloring is disabled with mode "auto". Explicitly enabling coloring overrides + the environment variable.