Answers for "printf color"

1

printf output with color

#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("%sredn", KRED);
    printf("%sgreenn", KGRN);
    printf("%syellown", KYEL);
    printf("%sbluen", KBLU);
    printf("%smagentan", KMAG);
    printf("%scyann", KCYN);
    printf("%swhiten", KWHT);
    printf("%snormaln", KNRM);

    return 0;
}
Posted by: Guest on December-13-2020
0

printf red color

Red 33[0;31m
Posted by: Guest on April-06-2021
0

printf blue color

Blue 33[0;34m
Posted by: Guest on April-06-2021

Browse Popular Code Answers by Language