Colors

Hi,I would like to know if it is possible to have diferent colors on your text.
There is the system("color (your choice)") to change background and foreground colors.
For example if i want to print text on red and after the next text message to be on green? without changing the one on red?
@Argy

Wow, that sounds great.
Last edited on
Well i am not exactly intrested in that.what i want is to create a mini game but i want the board to be white and the coins (where coins is this $) to be yellow.Also your life i want to be red.The background is black,this is the easy part. :P


EDIT:
I will try this code:
http://www.cplusplus.com/articles/Eyhv0pDG/
and i will let you know if i need some help.
BTW Thank you

EDIT 2:
I managed to do that with that code.
Last edited on
Argy, you may want to look at something like ncurses
http://en.wikipedia.org/wiki/Ncurses
Well something else which would be usefull to me,is how to make your own colors using RGB system.
Anyone with some ideas?
If you want to make a pretty user interface with colors don't waste your time working in the console. Just learn a GUI package: http://en.wikipedia.org/wiki/List_of_platform-independent_GUI_libraries
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{

	const HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
	for (unsigned i = 1; i < 15; ++i)
	{
		SetConsoleTextAttribute(console, i);
		cout << "Hellow world" << ' ' << i << endl;
		Sleep(500);
	}
	
	cin.ignore();
	return 0;
}
Topic archived. No new replies allowed.