From: Zbigniew Jędrzejewski-Szmek Date: Tue, 7 May 2019 15:42:46 +0000 (+0200) Subject: journalctl,shared/log: use yellow for warnings X-Git-Tag: v243-rc1~467^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12411%2Fhead;p=thirdparty%2Fsystemd.git journalctl,shared/log: use yellow for warnings In program output, highlighting warnings with ANSI_HIGHLIGHT is not enough, because it doesn't stand out enough. Yellow is more appropriate. I was worried that yellow wouldn't be visible on white background, but (at least gnome-terminal) uses a fairly dark yellow that is fully legible on white and light-colored backgrounds. We also used yellow in many places, e.g. systemctl, so this should be fine. Note: yellow is unreadable on urxvt with white background (urxvt +rv). But grey, which we already used, is also unreadable, so urxvt users would have to disable colors anyway, so this change does not make the problem intrinsically worse. See https://github.com/systemd/systemd/issues/12482#issuecomment-490374210. --- diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index 4676ce2a806..7d9e5d41ab4 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -1323,6 +1323,14 @@ void get_log_colors(int priority, const char **on, const char **off, const char if (highlight) *highlight = ANSI_HIGHLIGHT; + } else if (priority <= LOG_WARNING) { + if (on) + *on = ANSI_HIGHLIGHT_YELLOW; + if (off) + *off = ANSI_NORMAL; + if (highlight) + *highlight = ANSI_HIGHLIGHT; + } else if (priority <= LOG_NOTICE) { if (on) *on = ANSI_HIGHLIGHT;