Created
August 10, 2024 20:53
-
-
Save 3dgoose/9e4da7cd4a0d00c0c1c03dad7836d20f to your computer and use it in GitHub Desktop.
Print with colors in a terminal, snippet in Airlib.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment