spa: add a header for ANSI color sequences

Makes the code more readable and guarantees we use the same sequences for the
same colors everywhere.
This commit is contained in:
Peter Hutterer 2021-06-01 09:47:44 +10:00
parent 4c13eced55
commit 1a5faa7b52
4 changed files with 204 additions and 9 deletions

View file

@ -35,6 +35,7 @@
#include <spa/pod/iter.h>
#include <spa/debug/types.h>
#include <spa/utils/json.h>
#include <spa/utils/ansi.h>
#include <pipewire/pipewire.h>
#include <extensions/metadata.h>
@ -43,11 +44,11 @@
static bool colors = false;
#define NORMAL (colors ? "\x1B[0m":"")
#define LITERAL (colors ? "\x1B[95m":"")
#define NUMBER (colors ? "\x1B[96m":"")
#define STRING (colors ? "\x1B[92m":"")
#define KEY (colors ? "\x1B[94m":"")
#define NORMAL (colors ? SPA_ANSI_RESET : "")
#define LITERAL (colors ? SPA_ANSI_BRIGHT_MAGENTA : "")
#define NUMBER (colors ? SPA_ANSI_BRIGHT_CYAN : "")
#define STRING (colors ? SPA_ANSI_BRIGHT_GREEN : "")
#define KEY (colors ? SPA_ANSI_BRIGHT_BLUE : "")
struct data {
struct pw_main_loop *loop;