]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
terminal-util: merge COLOR_ON with COLOR_24BIT
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 23 Jun 2024 19:12:45 +0000 (04:12 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 24 Jun 2024 08:57:07 +0000 (17:57 +0900)
Currently, we assume that there is no restriction on coloring when
COLOR_24BIT. Let's merge the two values.

Follow-up for a5efbf468c96190c9562bc8121eda32310dfd112.

src/basic/terminal-util.c
src/basic/terminal-util.h

index 787ae7abace6f3b76c8f2919ad85da6845e1e892..6712d7c89d835d284742a6c0b2edd48138de21a0 100644 (file)
@@ -1328,15 +1328,15 @@ static ColorMode parse_systemd_colors(void) {
                 return COLOR_256;
         r = parse_boolean(e);
         if (r >= 0)
-                return r > 0 ? COLOR_ON : COLOR_OFF;
+                return r > 0 ? COLOR_24BIT : COLOR_OFF;
         return _COLOR_INVALID;
 }
 
 ColorMode get_color_mode(void) {
 
         /* Returns the mode used to choose output colors. The possible modes are COLOR_OFF for no colors,
-         * COLOR_16 for only the base 16 ANSI colors, COLOR_256 for more colors and COLOR_ON for unrestricted
-         * color output. For that we check $SYSTEMD_COLORS first (which is the explicit way to
+         * COLOR_16 for only the base 16 ANSI colors, COLOR_256 for more colors, and COLOR_24BIT for
+         * unrestricted color output. For that we check $SYSTEMD_COLORS first (which is the explicit way to
          * change the mode). If that didn't work we turn colors off unless we are on a TTY. And if we are on a TTY
          * we turn it off if $TERM is set to "dumb". There's one special tweak though: if we are PID 1 then we do not
          * check whether we are connected to a TTY, because we don't keep /dev/console open continuously due to fear
index bdc46618c8f77ded689bf79d578021f52a3ccd13..addb69f7faea91eef7fe406778a0221d51190b49 100644 (file)
@@ -122,16 +122,13 @@ typedef enum ColorMode {
         /* No colors, monochrome output. */
         COLOR_OFF,
 
-        /* All colors, no restrictions. */
-        COLOR_ON,
-
         /* Only the base 16 colors. */
         COLOR_16,
 
         /* Only 256 colors. */
         COLOR_256,
 
-        /* For truecolor or 24bit color support. */
+        /* For truecolor or 24bit color support, no restrictions. */
         COLOR_24BIT,
 
         _COLOR_INVALID = -EINVAL,