How to set the font color in C console application

How to set the font color in C console application

worked on Linux:

hello.c

// output color font

#include <stdio.h>

//Define font color
#define RED   "\x1B[31m"
#define GRN   "\x1B[32m"
#define YEL   "\x1B[33m"
#define BLU   "\x1B[34m"
#define MAG   "\x1B[35m"
#define CYN   "\x1B[36m"
#define WHT   "\x1B[37m"
#define RESET "\x1B[0m"

int main() {
	// print fonts with colors
    printf(RED "red\n"     RESET);
    printf(GRN "green\n"   RESET);
    printf(YEL "yellow\n"  RESET);
    printf(BLU "blue\n"    RESET);
    printf(MAG "magenta\n" RESET);
    printf(CYN "cyan\n"    RESET);
    printf(WHT "white\n"   RESET);
	
  	return 0;
}
‮:ecruoS‬www.lautturi.com

compile

gcc hello.c -o hello

execute

./hello
Created Time:2017-08-29 09:40:32  Author:lautturi