Printf Output With Color

[Solved] Printf Output With Color | C - Code Explorer | yomemimo.com
Question : printf output with color

Answered by : christian-lehnert

#include <stdio.h>
#define KNRM "\x1B[0m"
#define KRED "\x1B[31m"
#define KGRN "\x1B[32m"
#define KYEL "\x1B[33m"
#define KBLU "\x1B[34m"
#define KMAG "\x1B[35m"
#define KCYN "\x1B[36m"
#define KWHT "\x1B[37m"
int main()
{ printf("%sred\n", KRED); printf("%sgreen\n", KGRN); printf("%syellow\n", KYEL); printf("%sblue\n", KBLU); printf("%smagenta\n", KMAG); printf("%scyan\n", KCYN); printf("%swhite\n", KWHT); printf("%snormal\n", KNRM); return 0;
}

Source : https://stackoverflow.com/questions/5412761/using-colors-with-printf | Last Update : Sun, 20 Dec 20

Question : printf red color

Answered by : igor-jorge-saver-of-the-world

Red \033[0;31m

Source : https://www.theurbanpenguin.com/4184-2/ | Last Update : Tue, 13 Apr 21

Answers related to printf output with color

Code Explorer Popular Question For C