tree-wide: avoid direct use of color macros
This commit is contained in:
+1
-1
@@ -404,7 +404,7 @@ static int write_to_console(
|
||||
if (show_location) {
|
||||
const char *lon = "", *loff = "";
|
||||
if (log_get_show_color()) {
|
||||
lon = ANSI_HIGHLIGHT_YELLOW4;
|
||||
lon = ansi_highlight_yellow4();
|
||||
loff = ANSI_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -165,8 +165,7 @@ int ask_char(char *ret, const char *replies, const char *fmt, ...) {
|
||||
char c;
|
||||
bool need_nl = true;
|
||||
|
||||
if (colors_enabled())
|
||||
fputs(ANSI_HIGHLIGHT, stdout);
|
||||
fputs(ansi_highlight(), stdout);
|
||||
|
||||
putchar('\r');
|
||||
|
||||
@@ -174,8 +173,7 @@ int ask_char(char *ret, const char *replies, const char *fmt, ...) {
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (colors_enabled())
|
||||
fputs(ANSI_NORMAL, stdout);
|
||||
fputs(ansi_normal(), stdout);
|
||||
|
||||
fflush(stdout);
|
||||
|
||||
@@ -214,15 +212,13 @@ int ask_string(char **ret, const char *text, ...) {
|
||||
assert(ret);
|
||||
assert(text);
|
||||
|
||||
if (colors_enabled())
|
||||
fputs(ANSI_HIGHLIGHT, stdout);
|
||||
fputs(ansi_highlight(), stdout);
|
||||
|
||||
va_start(ap, text);
|
||||
vprintf(text, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (colors_enabled())
|
||||
fputs(ANSI_NORMAL, stdout);
|
||||
fputs(ansi_normal(), stdout);
|
||||
|
||||
fflush(stdout);
|
||||
|
||||
@@ -1384,7 +1380,7 @@ void get_log_colors(int priority, const char **on, const char **off, const char
|
||||
|
||||
if (priority <= LOG_ERR) {
|
||||
if (on)
|
||||
*on = ANSI_HIGHLIGHT_RED;
|
||||
*on = ansi_highlight_red();
|
||||
if (off)
|
||||
*off = ANSI_NORMAL;
|
||||
if (highlight)
|
||||
@@ -1392,7 +1388,7 @@ void get_log_colors(int priority, const char **on, const char **off, const char
|
||||
|
||||
} else if (priority <= LOG_WARNING) {
|
||||
if (on)
|
||||
*on = ANSI_HIGHLIGHT_YELLOW;
|
||||
*on = ansi_highlight_yellow();
|
||||
if (off)
|
||||
*off = ANSI_NORMAL;
|
||||
if (highlight)
|
||||
@@ -1404,14 +1400,14 @@ void get_log_colors(int priority, const char **on, const char **off, const char
|
||||
if (off)
|
||||
*off = ANSI_NORMAL;
|
||||
if (highlight)
|
||||
*highlight = ANSI_HIGHLIGHT_RED;
|
||||
*highlight = ansi_highlight_red();
|
||||
|
||||
} else if (priority >= LOG_DEBUG) {
|
||||
if (on)
|
||||
*on = ANSI_GREY;
|
||||
*on = ansi_grey();
|
||||
if (off)
|
||||
*off = ANSI_NORMAL;
|
||||
if (highlight)
|
||||
*highlight = ANSI_HIGHLIGHT_RED;
|
||||
*highlight = ansi_highlight_red();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,6 +208,7 @@ DEFINE_ANSI_FUNC(highlight_black, HIGHLIGHT_BLACK);
|
||||
DEFINE_ANSI_FUNC(highlight_red, HIGHLIGHT_RED);
|
||||
DEFINE_ANSI_FUNC(highlight_green, HIGHLIGHT_GREEN);
|
||||
DEFINE_ANSI_FUNC_256(highlight_yellow, HIGHLIGHT_YELLOW, HIGHLIGHT_YELLOW_FALLBACK);
|
||||
DEFINE_ANSI_FUNC_256(highlight_yellow4, HIGHLIGHT_YELLOW4, HIGHLIGHT_YELLOW_FALLBACK);
|
||||
DEFINE_ANSI_FUNC(highlight_blue, HIGHLIGHT_BLUE);
|
||||
DEFINE_ANSI_FUNC(highlight_magenta, HIGHLIGHT_MAGENTA);
|
||||
DEFINE_ANSI_FUNC(highlight_cyan, HIGHLIGHT_CYAN);
|
||||
|
||||
Reference in New Issue
Block a user