![]() |
librnr
1.14.5
RoadNarrows Robotics Common Library 1
|
Macros | |
| #define | ANSI_CSI "\033[" |
| Control Sequence Introducer. | |
| #define | ANSI_COLOR_PRE ANSI_CSI |
| color escape sequence prefix | |
| #define | ANSI_COLOR_SEP ";" |
| color values separator | |
| #define | ANSI_COLOR_MODE "m" |
| color mode | |
| #define | ANSI_SGR_TEXT_NORMAL "0" |
| color normal and reset to default | |
| #define | ANSI_SGR_TEXT_BOLD "1" |
| bold or increase intensity | |
| #define | ANSI_SGR_TEXT_UNDERSCORE "4" |
| underscore | |
| #define | ANSI_SGR_TEXT_BLINK "5" |
| slow blink | |
| #define | ANSI_SGR_TEXT_REVERSE "7" |
| swap fg and bg colors | |
| #define | ANSI_SGR_FG_COLOR_BLACK "30" |
| normal black | |
| #define | ANSI_SGR_FG_COLOR_RED "31" |
| normal red | |
| #define | ANSI_SGR_FG_COLOR_GREEN "32" |
| normal green | |
| #define | ANSI_SGR_FG_COLOR_YELLOW "33" |
| normal yellow (brown) | |
| #define | ANSI_SGR_FG_COLOR_BLUE "34" |
| normal blue | |
| #define | ANSI_SGR_FG_COLOR_MAGENTA "35" |
| normal magenta | |
| #define | ANSI_SGR_FG_COLOR_CYAN "36" |
| normal cyan | |
| #define | ANSI_SGR_FG_COLOR_WHITE "37" |
| normal white (gray) | |
| #define | ANSI_SGR_BG_COLOR_BLACK "40" |
| normal black | |
| #define | ANSI_SGR_BG_COLOR_RED "41" |
| normal red | |
| #define | ANSI_SGR_BG_COLOR_GREEN "42" |
| normal green | |
| #define | ANSI_SGR_BG_COLOR_YELLOW "43" |
| normal yellow (brown) | |
| #define | ANSI_SGR_BG_COLOR_BLUE "44" |
| normal blue | |
| #define | ANSI_SGR_BG_COLOR_MAGENTA "45" |
| normal magenta | |
| #define | ANSI_SGR_BG_COLOR_CYAN "46" |
| normal cyan | |
| #define | ANSI_SGR_BG_COLOR_WHITE "47" |
| normal white (gray) | |
| #define | ANSI_COLOR(_attr, _fg, _bg) ANSI_COLOR_PRE _attr ANSI_COLOR_SEP _fg ANSI_COLOR_SEP _bg ANSI_COLOR_MODE |
| Macro to build color escape sequence string. More... | |
| #define | ANSI_FG_COLOR(_fg) ANSI_COLOR_PRE ANSI_SGR_TEXT_NORMAL ANSI_COLOR_SEP _fg ANSI_COLOR_MODE |
| Macro to build normal foreground color escape sequence string. More... | |
| #define | ANSI_FG_BRIGHT_COLOR(_fg) ANSI_COLOR_PRE ANSI_SGR_TEXT_BOLD ANSI_COLOR_SEP _fg ANSI_COLOR_MODE |
| Macro to build bright foreground color escape sequence string. More... | |
| #define | ANSI_FG_ATTR_COLOR(_attr, _fg) ANSI_COLOR_PRE _attr ANSI_COLOR_SEP _fg ANSI_COLOR_MODE |
| Macro to build foreground color with the given text attribute escape sequence string. More... | |
| #define | ANSI_BG_COLOR(_bg) ANSI_COLOR_PRE _bg ANSI_COLOR_MODE |
| Macro to build background color escape sequence string. More... | |
| #define | ANSI_NORMAL_COLOR(_fg, _bg) ANSI_COLOR(ANSI_SGR_TEXT_NORMAL, _fg, _bg) |
| Macro to build normal color escape sequence string. More... | |
| #define | ANSI_BRIGHT_COLOR(_fg, _bg) ANSI_COLOR(ANSI_SGR_TEXT_BOLD, _fg, _bg) |
| Macro to build bright color escape sequence string. More... | |
| #define | ANSI_COLOR_RESET ANSI_CSI ANSI_SGR_TEXT_NORMAL ANSI_COLOR_MODE |
| color reset to default | |
ANSI escape color codes.
| #define ANSI_BG_COLOR | ( | _bg | ) | ANSI_COLOR_PRE _bg ANSI_COLOR_MODE |
| #define ANSI_BRIGHT_COLOR | ( | _fg, | |
| _bg | |||
| ) | ANSI_COLOR(ANSI_SGR_TEXT_BOLD, _fg, _bg) |
| #define ANSI_COLOR | ( | _attr, | |
| _fg, | |||
| _bg | |||
| ) | ANSI_COLOR_PRE _attr ANSI_COLOR_SEP _fg ANSI_COLOR_SEP _bg ANSI_COLOR_MODE |
| #define ANSI_FG_ATTR_COLOR | ( | _attr, | |
| _fg | |||
| ) | ANSI_COLOR_PRE _attr ANSI_COLOR_SEP _fg ANSI_COLOR_MODE |
| #define ANSI_FG_BRIGHT_COLOR | ( | _fg | ) | ANSI_COLOR_PRE ANSI_SGR_TEXT_BOLD ANSI_COLOR_SEP _fg ANSI_COLOR_MODE |
| #define ANSI_FG_COLOR | ( | _fg | ) | ANSI_COLOR_PRE ANSI_SGR_TEXT_NORMAL ANSI_COLOR_SEP _fg ANSI_COLOR_MODE |
| #define ANSI_NORMAL_COLOR | ( | _fg, | |
| _bg | |||
| ) | ANSI_COLOR(ANSI_SGR_TEXT_NORMAL, _fg, _bg) |
| int colorprintf | ( | const char * | sFgColor, |
| const char * | sFmt, | ||
| ... | |||
| ) |
Print output in the specified foreground color.
After printing, the colors are reset to defaults. Subsequent output will be in the default color.
| sFgColor | ANSI SGR foreground color string. |
| sFmt | Format string following printf(3) syntax. |
| ... | Variable argument list to print. |
Definition at line 32 of file color.c.
References reset_colors(), and set_color().
Referenced by reset_colors().
| INLINE_IN_H void set_color | ( | const char * | sColor | ) |
Set foreground or background color.
The color is in effect until a new foreground/background color is specified or the colors are reset to default values.
| sColor | ANSI SGR color string. |
Definition at line 219 of file color.h.
References ANSI_COLOR_MODE, and ANSI_COLOR_PRE.
Referenced by colorprintf().