Change Text Color in C – ANSI Escape Codes (No conio.h)
To change text color in C, print an ANSI escape code before your text: printf(“\033[31mRed text\033[0m\n”); prints in red and then resets. That’s the whole trick — no library, no header, no Turbo C. The old way you’ll still find in most tutorials, textcolor() from <conio.h>, only ever worked in MS-DOS compilers and won’t compile …