Skip to content

Instantly share code, notes, and snippets.

@volkansalma
Created June 28, 2012 06:31
Show Gist options
  • Save volkansalma/3009508 to your computer and use it in GitHub Desktop.
Save volkansalma/3009508 to your computer and use it in GitHub Desktop.
Colored console (windows)
#include <iostream>
#include <windows.h> // WinApi header
using namespace std; // std::cout, std::cin
int main()
{
HANDLE hConsole;
int k;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// you can loop k higher to see more color choices
for(k = 1; k < 255; k++)
{
// pick the colorattribute k you want
SetConsoleTextAttribute(hConsole, k);
cout << k << " Volkan SALMA!" << endl;
}
cin.get(); // wait
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment