[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Function: EGAcolor()
This function makes it possible to change the
color of a specific color register. It works on
EGA and VGA adaptors.
As you may have noted, there are 16 colors to
choose from when in text mode, whilst the EGA
can display up to 64 colors (and the VGA even
much more), but we're only using 16 (ugly ones)
of them! Enter EGAcolor(), now one can select
any EGA color for his text Colors.
This function also comes in handy when one
chooses to display a 512 character set, by
making 8 consistent colors (ie. making the last 8
colors equal to the 8 first colors).
Syntax: EGAcolor(<Reg>,<ColorCode>)
Arguments: <Reg> is the color register to adapt, it must
be in the range 0..15 (see Colors info for more
info). <ColorCode> is the EGA color one wishes to
change the <reg> color to. It must be in the
range 0..63 (see table for more info).
Returns: Nothing.
Usage: * - Make black blue, and blue black...
SetPalette(0,1)
SetPalette(1,0)
* - Easy huh?
Table: Here's a table with the EGA default values, and
the possibilities offered.
The 16 Standard Colors are defined as Follows:
Color Number Color EGA value
(Register) Name (3*2 bits combination)
------------------------------------------------------------
0 Black 0
1 Blue 1
2 Green 2
3 Cyan 3
4 Red 4
5 Magenta 5
6 Brown 20 (*)
7 Gray 7
8 LightGray 56
9 LightBlue 57
10 LightGreen 58
11 LightCyan 59
12 LightRed 60
13 LightMagenta 61
14 Yellow 62
15 White 63
------------------------------------------------------------
If you wish to adapt any of those standard colors (an example
where this is useful is when you are to display 512 characters
on the screen at the same time, by making the colors registers 8
through 15 equal to those of 0 through 7) you can do so with this
function.
The EGA color consists of 6 bits which are defined as Follows
Bit Number: 0 1 2 3 4 5
Value: 1 2 4 8 16 32
Color Intensity: b g r B G R
(Add the values to combine colors)
Where r-g-b stands for primary red, green and blue, and R-G-B for
secondary. The primary colors have 2/3 intensity, the secondary
1/3. For example, 10 is a Blueish Green, as 10 = 2 + 8, which
is 21 + 23, which thus combines g and B.
Putting Only a secondary blue on black, gives us a funny, fatty
blueish black, to do this: SetPalette(0,8), That's all!
(*) Personally I find brown very ugly and have the habit of setting
this to normal yellow (EGA color 6) by issuing EGAcolor(6,6).
See Also:
VGAcolor()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson