Hey everyone,

I want my code to generate a color like it would generate in a C# application.

For example Light Green versus Standard Green :
http://img694.imageshack.us/img694/3233/colore.jpg

#include <iostream>
#include <Windows.h>

using namespace std;

void initColor(int);

int main()
{	
	initColor(2);
	cout << "===== INITIALISATION =====" << endl;
	initColor(7);

  	return 0;
}

void initColor(int color)
{
	HANDLE  hConsole;
  	hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(hConsole, color);
}

If anyone can help me it would be gladly appreciated.

Recommended Answers

All 2 Replies

The color you want is initColor(FOREGROUND_GREEN | FOREGROUND_INTENSITY) . And it's generally more informative to use the macros rather than hardcoded values.

It works now.. thanks alot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.