Skip to content

Instantly share code, notes, and snippets.

@bw2012
Last active December 23, 2022 21:10
Show Gist options
  • Save bw2012/85f345a2b18d84a3dbe56756dde9c852 to your computer and use it in GitHub Desktop.
Save bw2012/85f345a2b18d84a3dbe56756dde9c852 to your computer and use it in GitHub Desktop.
Sample color console for C/C++
// https://stackoverflow.com/questions/4053837/colorizing-text-in-the-console-with-c
#include <iostream>
#include <string>
int main(int argc, char ** argv){
printf("\n");
printf("\x1B[31mTexting\033[0m\t\t");
printf("\x1B[32mTexting\033[0m\t\t");
printf("\x1B[33mTexting\033[0m\t\t");
printf("\x1B[34mTexting\033[0m\t\t");
printf("\x1B[35mTexting\033[0m\n");
printf("\x1B[36mTexting\033[0m\t\t");
printf("\x1B[36mTexting\033[0m\t\t");
printf("\x1B[36mTexting\033[0m\t\t");
printf("\x1B[37mTexting\033[0m\t\t");
printf("\x1B[93mTexting\033[0m\n");
printf("\033[3;42;30mTexting\033[0m\t\t");
printf("\033[3;43;30mTexting\033[0m\t\t");
printf("\033[3;44;30mTexting\033[0m\t\t");
printf("\033[3;104;30mTexting\033[0m\t\t");
printf("\033[3;100;30mTexting\033[0m\n");
printf("\033[3;47;35mTexting\033[0m\t\t");
printf("\033[2;47;35mTexting\033[0m\t\t");
printf("\033[1;47;35mTexting\033[0m\t\t");
printf("\t\t");
printf("\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment