19#define TERM_ESCAPTE_CHAR "\x1b["
23 const char *_empty_str =
"";
24 const char *_esc_char = TERM_ESCAPTE_CHAR;
25 const char *_reset = TERM_ESCAPTE_CHAR
"0m";
26 const char *_bold = TERM_ESCAPTE_CHAR
"1m";
27 const char *_faint = TERM_ESCAPTE_CHAR
"2m";
28 const char *_underline = TERM_ESCAPTE_CHAR
"4m";
29 const char *_blink = TERM_ESCAPTE_CHAR
"5m";
30 const char *_col8b_black = TERM_ESCAPTE_CHAR
"30m";
31 const char *_col8b_red = TERM_ESCAPTE_CHAR
"31m";
32 const char *_col8b_green = TERM_ESCAPTE_CHAR
"32m";
33 const char *_col8b_yellow = TERM_ESCAPTE_CHAR
"33m";
34 const char *_col8b_blue = TERM_ESCAPTE_CHAR
"34m";
35 const char *_col8b_magenta = TERM_ESCAPTE_CHAR
"35m";
36 const char *_col8b_cyan = TERM_ESCAPTE_CHAR
"36m";
37 const char *_col8b_white = TERM_ESCAPTE_CHAR
"37m";
43 const char *
reset() {
return (colors_enabled) ? _reset : _empty_str; }
44 const char *
bold() {
return (colors_enabled) ? _bold : _empty_str; }
45 const char *
faint() {
return (colors_enabled) ? _faint : _empty_str; }
46 const char *
underline() {
return (colors_enabled) ? _underline : _empty_str; }
47 const char *
blink() {
return (colors_enabled) ? _blink : _empty_str; }
51 const char *
black() {
return (colors_enabled) ? _col8b_black : _empty_str; }
52 const char *
red() {
return (colors_enabled) ? _col8b_red : _empty_str; }
53 const char *
green() {
return (colors_enabled) ? _col8b_green : _empty_str; }
54 const char *
yellow() {
return (colors_enabled) ? _col8b_yellow : _empty_str; }
55 const char *
blue() {
return (colors_enabled) ? _col8b_blue : _empty_str; }
56 const char *
magenta() {
return (colors_enabled) ? _col8b_magenta : _empty_str; }
57 const char *
cyan() {
return (colors_enabled) ? _col8b_cyan : _empty_str; }
58 const char *
white() {
return (colors_enabled) ? _col8b_white : _empty_str; }
Terminal color escape sequences and enable/disable control.
void enable_colors()
Enable terminal color output.
void disable_colors()
Disable all terminal color output.
bool are_colors_enabled()
Query whether terminal color output is currently enabled.
const char * red()
Escape sequence to set red text color.
const char * green()
Escape sequence to set green text color.
const char * black()
Escape sequence to set black text color.
const char * white()
Escape sequence to set white text color.
const char * magenta()
Escape sequence to set magenta (pink) text color.
const char * cyan()
Escape sequence to set cyan text color.
const char * blue()
Escape sequence to set blue text color.
const char * yellow()
Escape sequence to set yellow text color.
Terminal text styling escape sequences (bold, faint, underline, blink, reset).
const char * blink()
escape sequence to set blinking text formatting.
const char * reset()
escape sequence to reset the terminal text formatting.
const char * bold()
escape sequence to set bold text formatting.
const char * underline()
escape sequence to set underlined text formatting.
const char * faint()
escape sequence to set faint (dim) text formatting.
bool colors_enabled()
Are colors enabled.