I am making a simple application which requires colored output. How can I make my output colored like emacs and bash do?
I don't care about Windows, as my application is only for UNIX systems.
I am making a simple application which requires colored output. How can I make my output colored like emacs and bash do?
I don't care about Windows, as my application is only for UNIX systems.
#include <stdio.h>
#define BLUE(string) "\x1b[34m" string "\x1b[0m"
#define RED(string) "\x1b[31m" string "\x1b[0m"
int main(void)
{
printf("this is " RED("red") "!\n");
// a somewhat more complex ...
printf("this is " BLUE("%s") "!\n","blue");
return 0;
}
reading Wikipedia: