I have the following defines:
#define ANSI_COLOR_RED \"\\e[31m\" #define ANSI_COLOR_GREEN \"\\e[32m\" #define ANSI_COLOR_YELLOW \"\\e[33m\" #define ANSI_C
Notice that \e is not a standard escape code and may thus fail (behaviour is undefined!):
\e
% gcc ansi.c -pedantic ansi.c: In function ‘main’: ansi.c:4:12: warning: non-ISO-standard escape sequence, '\e' printf("\e[1;32mfoobar");
Use \033 or \x1B instead.
\033
\x1B