mirror of
https://github.com/systemd/systemd.git
synced 2025-08-24 09:49:49 +03:00
terminal-util: get_color_mode checks COLORTERM
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
51cef2b56f
commit
a5efbf468c
@ -1278,6 +1278,11 @@ ColorMode get_color_mode(void) {
|
|||||||
/* We only check for the presence of the variable; value is ignored. */
|
/* We only check for the presence of the variable; value is ignored. */
|
||||||
cached_color_mode = COLOR_OFF;
|
cached_color_mode = COLOR_OFF;
|
||||||
|
|
||||||
|
else if (STRPTR_IN_SET(getenv("COLORTERM"),
|
||||||
|
"truecolor",
|
||||||
|
"24bit"))
|
||||||
|
cached_color_mode = COLOR_24BIT;
|
||||||
|
|
||||||
else if (getpid_cached() == 1)
|
else if (getpid_cached() == 1)
|
||||||
/* PID1 outputs to the console without holding it open all the time.
|
/* PID1 outputs to the console without holding it open all the time.
|
||||||
*
|
*
|
||||||
|
@ -100,16 +100,19 @@ typedef enum AcquireTerminalFlags {
|
|||||||
/* Limits the use of ANSI colors to a subset. */
|
/* Limits the use of ANSI colors to a subset. */
|
||||||
typedef enum ColorMode {
|
typedef enum ColorMode {
|
||||||
/* No colors, monochrome output. */
|
/* No colors, monochrome output. */
|
||||||
COLOR_OFF = 0,
|
COLOR_OFF,
|
||||||
|
|
||||||
/* All colors, no restrictions. */
|
/* All colors, no restrictions. */
|
||||||
COLOR_ON = 1,
|
COLOR_ON,
|
||||||
|
|
||||||
/* Only the base 16 colors. */
|
/* Only the base 16 colors. */
|
||||||
COLOR_16 = 16,
|
COLOR_16,
|
||||||
|
|
||||||
/* Only 256 colors. */
|
/* Only 256 colors. */
|
||||||
COLOR_256 = 256,
|
COLOR_256,
|
||||||
|
|
||||||
|
/* For truecolor or 24bit color support.*/
|
||||||
|
COLOR_24BIT,
|
||||||
|
|
||||||
_COLOR_INVALID = -EINVAL,
|
_COLOR_INVALID = -EINVAL,
|
||||||
} ColorMode;
|
} ColorMode;
|
||||||
|
Reference in New Issue
Block a user