Author: Federico Corigliano
Date: 18:55:05 12/13/03
Go up one level in this thread
Hi Geoff
I use this in Chispa:
enum COLORS {
BLACK = 0,
BLUE,
GREEN,
CYAN,
RED,
MAGENTA,
BROWN,
LIGHTGRAY,
DARKGRAY,
LIGHTBLUE,
LIGHTGREEN,
LIGHTCYAN,
LIGHTRED,
LIGHTMAGENTA,
YELLOW,
WHITE
};
static int __BACKGROUND = BLACK;
static int __FOREGROUND = LIGHTGRAY;
void textbackground (int color)
{
__BACKGROUND = color;
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), (unsigned
short)(__FOREGROUND + (color << 4)));
}
void textcolor (int color)
{
__FOREGROUND = color;
SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), (unsigned
short)(color + (__BACKGROUND << 4)));
}
You must use textbackgroud() or textcolor() before to print anything. It works
with stdio functions for C and iostream for C++
Regards,
Federico
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.