Home > Enterprise >  Colored Text Windows Command Line
Colored Text Windows Command Line

Time:11-07

Recently I'm messing around with colors in the terminal.

I'm using a sample program from colors

Below is the exact same program, but in cmd.exe in which you can't see the colors.

No colors

In the same exact console however, when I run the command gcc I do get additional colors (white and red, in fact):

gcc

Now my question is, what does gcc do differently, to still be able to print colored text? I can't find any other way to get colored text on the console than written on the linked site above.

CodePudding user response:

Use the SetConsoleTextAttribute() API

  • Related