Debian Codegraph @

include/utils/color.h

raw
1 #ifndef COLOR_H
2 #define COLOR_H
3
4 #include "parse_args.h"
5 #include <stdbool.h>
6 #include <stdio.h>
7
8 extern bool color_enable;
9 extern bool log_color_enable;
10
11 extern void set_color (color_mode_t color, FILE *output);
12
13 extern void push_color (bool enable);
14
15 extern void pop_color (void);
16
17 #define CLR "\x1b[0m"
18
19 #define REDCLR "\x1b[31m"
20 #define GREENCLR "\x1b[32m"
21 #define YELLOWCLR "\x1b[33m"
22 #define BLUECLR "\x1b[34m"
23 #define CYANCLR "\x1b[36m"
24 #define PURPLECLR "\x1b[95m"
25 #define LIGHTCLR "\x1b[90m"
26 #define BRIGHT_YELLOWCLR "\x1b[93m"
27 #define BRIGHT_BLUECLR "\x1b[94m"
28 #define BRIGHT_CYANCLR "\x1b[96m"
29
30 #define RED(str) ((color_enable) ? (REDCLR str CLR) : str)
31 #define GREEN(str) ((color_enable) ? (GREENCLR str CLR) : str)
32 #define YELLOW(str) ((color_enable) ? (YELLOWCLR str CLR) : str)
33 #define BRIGHT_YELLOW(str) ((color_enable) ? (BRIGHT_YELLOWCLR str CLR) : str)
34 #define BLUE(str) ((color_enable) ? (BLUECLR str CLR) : str)
35 #define BRIGHT_BLUE(str) ((color_enable) ? (BRIGHT_BLUECLR str CLR) : str)
36 #define CYAN(str) ((color_enable) ? (CYANCLR str CLR) : str)
37 #define BRIGHT_CYAN(str) ((color_enable) ? (BRIGHT_CYANCLR str CLR) : str)
38 #define PURPLE(str) ((color_enable) ? (PURPLECLR str CLR) : str)
39 #define LIGHT(str) ((color_enable) ? (LIGHTCLR str CLR) : str)
40
41 #endif