Skip to content

Instantly share code, notes, and snippets.

@FLAK-ZOSO
Created March 3, 2022 13:29
Show Gist options
  • Save FLAK-ZOSO/119c3f8ea1977f90c7ec4c8e524c42b2 to your computer and use it in GitHub Desktop.
Save FLAK-ZOSO/119c3f8ea1977f90c7ec4c8e524c42b2 to your computer and use it in GitHub Desktop.
Colours in C++ with windows.h
#include <iostream>
#include <stdlib.h>
#include <windows.h>
using namespace std;
void SetColor(short Color) {
HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hCon,Color);
}
int main() {
SetColor(15);
cout << "Some color" << endl << endl;
SetColor(4);
cout << "One other color";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment