46 #define ANSI_CSI "\033[" 51 #define ANSI_COLOR_PRE ANSI_CSI 52 #define ANSI_COLOR_SEP ";"
53 #define ANSI_COLOR_MODE "m"
58 #define ANSI_SGR_TEXT_NORMAL "0" 59 #define ANSI_SGR_TEXT_BOLD "1"
60 #define ANSI_SGR_TEXT_UNDERSCORE "4"
61 #define ANSI_SGR_TEXT_BLINK "5"
62 #define ANSI_SGR_TEXT_REVERSE "7"
67 #define ANSI_SGR_FG_COLOR_BLACK "30" 68 #define ANSI_SGR_FG_COLOR_RED "31"
69 #define ANSI_SGR_FG_COLOR_GREEN "32"
70 #define ANSI_SGR_FG_COLOR_YELLOW "33"
71 #define ANSI_SGR_FG_COLOR_BLUE "34"
72 #define ANSI_SGR_FG_COLOR_MAGENTA "35"
73 #define ANSI_SGR_FG_COLOR_CYAN "36"
74 #define ANSI_SGR_FG_COLOR_WHITE "37"
79 #define ANSI_SGR_BG_COLOR_BLACK "40" 80 #define ANSI_SGR_BG_COLOR_RED "41"
81 #define ANSI_SGR_BG_COLOR_GREEN "42"
82 #define ANSI_SGR_BG_COLOR_YELLOW "43"
83 #define ANSI_SGR_BG_COLOR_BLUE "44"
84 #define ANSI_SGR_BG_COLOR_MAGENTA "45"
85 #define ANSI_SGR_BG_COLOR_CYAN "46"
86 #define ANSI_SGR_BG_COLOR_WHITE "47"
95 #define ANSI_COLOR(_attr, _fg, _bg) \ 96 ANSI_COLOR_PRE _attr ANSI_COLOR_SEP _fg ANSI_COLOR_SEP _bg ANSI_COLOR_MODE 105 #define ANSI_FG_COLOR(_fg) \ 106 ANSI_COLOR_PRE ANSI_SGR_TEXT_NORMAL ANSI_COLOR_SEP _fg ANSI_COLOR_MODE 115 #define ANSI_FG_BRIGHT_COLOR(_fg) \ 116 ANSI_COLOR_PRE ANSI_SGR_TEXT_BOLD ANSI_COLOR_SEP _fg ANSI_COLOR_MODE 127 #define ANSI_FG_ATTR_COLOR(_attr, _fg) \ 128 ANSI_COLOR_PRE _attr ANSI_COLOR_SEP _fg ANSI_COLOR_MODE 137 #define ANSI_BG_COLOR(_bg) ANSI_COLOR_PRE _bg ANSI_COLOR_MODE 147 #define ANSI_NORMAL_COLOR(_fg, _bg) ANSI_COLOR(ANSI_SGR_TEXT_NORMAL, _fg, _bg) 157 #define ANSI_BRIGHT_COLOR(_fg, _bg) ANSI_COLOR(ANSI_SGR_TEXT_BOLD, _fg, _bg) 166 #define ANSI_COLOR_RESET \ 167 ANSI_CSI ANSI_SGR_TEXT_NORMAL ANSI_COLOR_MODE 173 #define ANSI_FG_BLACK ANSI_FG_COLOR(ANSI_SGR_FG_COLOR_BLACK) 174 #define ANSI_FG_RED ANSI_FG_COLOR(ANSI_SGR_FG_COLOR_RED) 175 #define ANSI_FG_GREEN ANSI_FG_COLOR(ANSI_SGR_FG_COLOR_GREEN) 176 #define ANSI_FG_YELLOW ANSI_FG_COLOR(ANSI_SGR_FG_COLOR_YELLOW) 177 #define ANSI_FG_BLUE ANSI_FG_COLOR(ANSI_SGR_FG_COLOR_BLUE) 178 #define ANSI_FG_MAGENTA ANSI_FG_COLOR(ANSI_SGR_FG_COLOR_MAGENTA) 179 #define ANSI_FG_CYAN ANSI_FG_COLOR(ANSI_SGR_FG_COLOR_CYAN) 180 #define ANSI_FG_WHITE ANSI_FG_COLOR(ANSI_SGR_FG_COLOR_WHITE) 182 #define ANSI_FG_BRIGHT_BLACK ANSI_FG_BRIGHT_COLOR(ANSI_SGR_FG_COLOR_BLACK) 183 #define ANSI_FG_BRIGHT_RED ANSI_FG_BRIGHT_COLOR(ANSI_SGR_FG_COLOR_RED) 184 #define ANSI_FG_BRIGHT_GREEN ANSI_FG_BRIGHT_COLOR(ANSI_SGR_FG_COLOR_GREEN) 185 #define ANSI_FG_BRIGHT_YELLOW ANSI_FG_BRIGHT_COLOR(ANSI_SGR_FG_COLOR_YELLOW) 186 #define ANSI_FG_BRIGHT_BLUE ANSI_FG_BRIGHT_COLOR(ANSI_SGR_FG_COLOR_BLUE) 187 #define ANSI_FG_BRIGHT_MAGENTA ANSI_FG_BRIGHT_COLOR(ANSI_SGR_FG_COLOR_MAGENTA) 188 #define ANSI_FG_BRIGHT_CYAN ANSI_FG_BRIGHT_COLOR(ANSI_SGR_FG_COLOR_CYAN) 189 #define ANSI_FG_BRIGHT_WHITE ANSI_FG_BRIGHT_COLOR(ANSI_SGR_FG_COLOR_WHITE) 196 #define ANSI_BG_BLACK ANSI_FG_COLOR(ANSI_SGR_BG_COLOR_BLACK) 197 #define ANSI_BG_RED ANSI_FG_COLOR(ANSI_SGR_BG_COLOR_RED) 198 #define ANSI_BG_GREEN ANSI_FG_COLOR(ANSI_SGR_BG_COLOR_GREEN) 199 #define ANSI_BG_YELLOW ANSI_FG_COLOR(ANSI_SGR_BG_COLOR_YELLOW) 200 #define ANSI_BG_BLUE ANSI_FG_COLOR(ANSI_SGR_BG_COLOR_BLUE) 201 #define ANSI_BG_MAGENTA ANSI_FG_COLOR(ANSI_SGR_BG_COLOR_MAGENTA) 202 #define ANSI_BG_CYAN ANSI_FG_COLOR(ANSI_SGR_BG_COLOR_CYAN) 203 #define ANSI_BG_WHITE ANSI_FG_COLOR(ANSI_SGR_BG_COLOR_WHITE) 247 extern int colorprintf(
const char *sFgColor,
const char *sFmt, ...);
256 #endif // _RNR_COLOR_H int colorprintf(const char *sFgColor, const char *sFmt,...)
Print output in the specified foreground color.
INLINE_IN_H void set_color(const char *sColor)
Set foreground or background color.
INLINE_IN_H void reset_colors()
Reset foreground and background colors to defaults.
#define ANSI_COLOR_MODE
color mode
#define ANSI_COLOR_RESET
color reset to default
#define C_DECLS_BEGIN
C declaration block begin in C.
RoadNarrows Robotics common configuration file.
#define INLINE_IN_H
inline C funtion in C header
#define C_DECLS_END
C declaration block end in C.
#define ANSI_COLOR_PRE
color escape sequence prefix