diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-12-16 19:55:32 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-12-17 09:15:26 +0100 |
commit | ddbf960574a3bb4b0be3dba929ad922bfa037a99 (patch) | |
tree | 09594462001f4f5964e34d27d27dae5c30f92c99 /src/basic/terminal-util.c | |
parent | Merge pull request #17998 from mrc0mmand/qemu-drop-trailing-whitespace (diff) | |
download | systemd-ddbf960574a3bb4b0be3dba929ad922bfa037a99.tar.xz systemd-ddbf960574a3bb4b0be3dba929ad922bfa037a99.zip |
terminal-util: use 256 color mode for PID 1 output, too
Follow-up for: #17702
Alsoe, see earlier review comment: https://github.com/systemd/systemd/pull/17702#pullrequestreview-552329600
Diffstat (limited to '')
-rw-r--r-- | src/basic/terminal-util.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index 7c003f80dd..3fc03050ac 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -1240,9 +1240,14 @@ ColorMode get_color_mode(void) { else if (getpid_cached() == 1) /* PID1 outputs to the console without holding it open all the time. - * Also note the Linux console can only handle 16 colors. - */ - cached_color_mode = getenv_terminal_is_dumb() ? COLOR_OFF : COLOR_16; + * + * Note that the Linux console can only display 16 colors. We still enable 256 color + * mode even for PID1 output though (which typically goes to the Linux console), + * since the Linux console is able to parse the 256 color sequences and automatically + * map them to the closest color in the 16 color palette (since kernel 3.16). Doing + * 256 colors is nice for people who invoke systemd in a container or via a serial + * link or such, and use a true 256 color terminal to do so. */ + cached_color_mode = getenv_terminal_is_dumb() ? COLOR_OFF : COLOR_256; else cached_color_mode = terminal_is_dumb() ? COLOR_OFF : COLOR_256; } |