mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-06 21:10:15 +01:00
util: fix the ANSI escape codes for bright colors, add some more
The previous incarnations of BRIGHT_FOO were actually bold foo. Change the colors over to use the actual bright colors and make bold a separate set of defines. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1240>
This commit is contained in:
parent
0678ef2b98
commit
b61a896407
4 changed files with 44 additions and 15 deletions
|
|
@ -44,7 +44,7 @@
|
|||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
|
||||
#define ANSI_BOLD "\x1B[0;1m"
|
||||
#define ANSI_RED "\x1B[0;31m"
|
||||
#define ANSI_GREEN "\x1B[0;32m"
|
||||
#define ANSI_YELLOW "\x1B[0;33m"
|
||||
|
|
@ -52,15 +52,44 @@
|
|||
#define ANSI_MAGENTA "\x1B[0;35m"
|
||||
#define ANSI_CYAN "\x1B[0;36m"
|
||||
#define ANSI_WHITE "\x1B[0;37m"
|
||||
#define ANSI_BRIGHT_RED "\x1B[0;31;1m"
|
||||
#define ANSI_BRIGHT_GREEN "\x1B[0;32;1m"
|
||||
#define ANSI_BRIGHT_YELLOW "\x1B[0;33;1m"
|
||||
#define ANSI_BRIGHT_BLUE "\x1B[0;34;1m"
|
||||
#define ANSI_BRIGHT_MAGENTA "\x1B[0;35;1m"
|
||||
#define ANSI_BRIGHT_CYAN "\x1B[0;36;1m"
|
||||
#define ANSI_BRIGHT_WHITE "\x1B[0;37;1m"
|
||||
#define ANSI_BRIGHT_RED "\x1B[0;91m"
|
||||
#define ANSI_BRIGHT_GREEN "\x1B[0;92m"
|
||||
#define ANSI_BRIGHT_YELLOW "\x1B[0;93m"
|
||||
#define ANSI_BRIGHT_BLUE "\x1B[0;94m"
|
||||
#define ANSI_BRIGHT_MAGENTA "\x1B[0;95m"
|
||||
#define ANSI_BRIGHT_CYAN "\x1B[0;96m"
|
||||
#define ANSI_BRIGHT_WHITE "\x1B[0;97m"
|
||||
#define ANSI_BOLD_RED "\x1B[0;1;31m"
|
||||
#define ANSI_BOLD_GREEN "\x1B[0;1;32m"
|
||||
#define ANSI_BOLD_YELLOW "\x1B[0;1;33m"
|
||||
#define ANSI_BOLD_BLUE "\x1B[0;1;34m"
|
||||
#define ANSI_BOLD_MAGENTA "\x1B[0;1;35m"
|
||||
#define ANSI_BOLD_CYAN "\x1B[0;1;36m"
|
||||
#define ANSI_BOLD_WHITE "\x1B[0;1;37m"
|
||||
#define ANSI_BOLD_BRIGHT_RED "\x1B[0;1;91m"
|
||||
#define ANSI_BOLD_BRIGHT_GREEN "\x1B[0;1;92m"
|
||||
#define ANSI_BOLD_BRIGHT_YELLOW "\x1B[0;1;93m"
|
||||
#define ANSI_BOLD_BRIGHT_BLUE "\x1B[0;1;94m"
|
||||
#define ANSI_BOLD_BRIGHT_MAGENTA "\x1B[0;1;95m"
|
||||
#define ANSI_BOLD_BRIGHT_CYAN "\x1B[0;1;96m"
|
||||
#define ANSI_BOLD_BRIGHT_WHITE "\x1B[0;1;97m"
|
||||
#define ANSI_NORMAL "\x1B[0m"
|
||||
|
||||
#define ANSI_BG_RED "\x1B[0;41m"
|
||||
#define ANSI_BG_GREEN "\x1B[0;42m"
|
||||
#define ANSI_BG_YELLOW "\x1B[0;43m"
|
||||
#define ANSI_BG_BLUE "\x1B[0;44m"
|
||||
#define ANSI_BG_MAGENTA "\x1B[0;45m"
|
||||
#define ANSI_BG_CYAN "\x1B[0;46m"
|
||||
#define ANSI_BG_WHITE "\x1B[0;47m"
|
||||
#define ANSI_BG_BRIGHT_RED "\x1B[0;101m"
|
||||
#define ANSI_BG_BRIGHT_GREEN "\x1B[0;102m"
|
||||
#define ANSI_BG_BRIGHT_YELLOW "\x1B[0;103m"
|
||||
#define ANSI_BG_BRIGHT_BLUE "\x1B[0;104m"
|
||||
#define ANSI_BG_BRIGHT_MAGENTA "\x1B[0;105m"
|
||||
#define ANSI_BG_BRIGHT_CYAN "\x1B[0;106m"
|
||||
#define ANSI_BG_BRIGHT_WHITE "\x1B[0;107m"
|
||||
|
||||
#define ANSI_UP "\x1B[%dA"
|
||||
#define ANSI_DOWN "\x1B[%dB"
|
||||
#define ANSI_RIGHT "\x1B[%dC"
|
||||
|
|
|
|||
|
|
@ -709,12 +709,12 @@ litest_runner_log_test_result(struct litest_runner *runner, struct litest_runner
|
|||
litest_assert_int_le(t->result, (enum litest_runner_result)LITEST_SYSTEM_ERROR);
|
||||
|
||||
switch (t->result) {
|
||||
case LITEST_PASS: color = ANSI_BRIGHT_GREEN; break;
|
||||
case LITEST_FAIL: color = ANSI_BRIGHT_RED; break;
|
||||
case LITEST_SKIP: color = ANSI_BRIGHT_YELLOW; break;
|
||||
case LITEST_PASS: color = ANSI_BOLD_GREEN; break;
|
||||
case LITEST_FAIL: color = ANSI_BOLD_RED; break;
|
||||
case LITEST_SKIP: color = ANSI_BOLD_YELLOW; break;
|
||||
case LITEST_NOT_APPLICABLE: color = ANSI_BLUE; break;
|
||||
case LITEST_TIMEOUT: color = ANSI_BRIGHT_CYAN; break;
|
||||
case LITEST_SYSTEM_ERROR: color = ANSI_BRIGHT_MAGENTA; break;
|
||||
case LITEST_TIMEOUT: color = ANSI_BOLD_CYAN; break;
|
||||
case LITEST_SYSTEM_ERROR: color = ANSI_BOLD_MAGENTA; break;
|
||||
}
|
||||
|
||||
fprintf(runner->fp, " - name: \"%s\"\n", t->desc.name);
|
||||
|
|
|
|||
|
|
@ -1293,7 +1293,7 @@ litest_log_handler(struct libinput *libinput,
|
|||
switch(pri) {
|
||||
case LIBINPUT_LOG_PRIORITY_INFO:
|
||||
priority = "info ";
|
||||
color = ANSI_HIGHLIGHT;
|
||||
color = ANSI_BOLD;
|
||||
break;
|
||||
case LIBINPUT_LOG_PRIORITY_ERROR:
|
||||
priority = "error";
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ log_handler(struct libinput *li,
|
|||
else
|
||||
printf(ANSI_RED);
|
||||
} else if (priority >= LIBINPUT_LOG_PRIORITY_INFO) {
|
||||
printf(ANSI_HIGHLIGHT);
|
||||
printf(ANSI_BOLD);
|
||||
} else if (priority == LIBINPUT_LOG_PRIORITY_DEBUG) {
|
||||
if (dispatch_counter != last_dispatch_no)
|
||||
color_toggle = !color_toggle;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue