diff --git a/man/less-variables.xml b/man/less-variables.xml index 03e4b35388..08e513c99f 100644 --- a/man/less-variables.xml +++ b/man/less-variables.xml @@ -73,6 +73,17 @@ + + $SYSTEMD_URLIFY diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index 98c3ff04ef..511734cbbb 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -1206,6 +1206,11 @@ bool colors_enabled(void) { val = getenv_bool("SYSTEMD_COLORS"); if (val >= 0) cached_colors_enabled = val; + + else if (getenv("NO_COLOR")) + /* We only check for the presence of the variable; value is ignored. */ + cached_colors_enabled = false; + else if (getpid_cached() == 1) /* PID1 outputs to the console without holding it open all the time */ cached_colors_enabled = !getenv_terminal_is_dumb(); @@ -1231,6 +1236,9 @@ bool dev_console_colors_enabled(void) { if (b >= 0) return b; + if (getenv("NO_COLOR")) + return false; + if (getenv_for_pid(1, "TERM", &s) <= 0) (void) proc_cmdline_get_key("TERM", 0, &s);