[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
xBase MsDos color management
--------------------------------------------------------------------------------
Standard MsDos xBase color management is based on strings which are a
combination of the following elements:
Base colors
Black ......... "N" Color structure
Blue ......... "B"
Green ......... "G" [ + ] [ * ] "<ForeColor> / <BackColor>"
Cyan ......... "BG"
Red ......... "R"
Magenta ....... "RB"
Brown ......... "GR" (a/k/a yellow)
White ......... "W"
[ + ] Intensity
[ * ] Blinking or Back intensity
<ForeColor> One of the above base colors
<BackColor> One of the above base colors
Example: If we want to use high intensity white letters on blue background,
we have to use the following color string:
"W+/B" --> "W" White ForeColor
"+" High intensity ForeColor
"B" Blue BackColor
At the MsDos hardware level, colors have the following structure:
Screen internal map
<Char><Color><Char><Color><Char><Color><Char><Color>....
Where <Char> is each of the characters we see on the screen and <Color>
is the color of each character (attribute). Each <Color> is represented
in only one byte.
Binary representation
of a byte color
X X X X X X X X --> Eight bits ( = one byte )
7 6 5 4 3 2 1 0 Bits order
Bits N.
=============
7 --> Back color intensity or Blinking
6,5,4 --> Back color
3 --> Fore color intensity
2,1,0 --> Fore color
The color we specify as a string in xBase in translated -in MsDos- in
one byte. Each xBase base color is a number from 0 to 7:
Black ......... "N" ....... 0 ..... 0 0 0
Blue ......... "B" ....... 1 ..... 0 0 1
Green ......... "G" ....... 2 ..... 0 1 0
Cyan ......... "BG" ....... 3 ..... 0 1 1 Binary
Red ......... "R" ....... 4 ..... 1 0 0 representation
Magenta ....... "RB" ....... 5 ..... 1 0 1
Brown ......... "GR" ....... 6 ..... 1 1 0
White ......... "W" ....... 7 ..... 1 1 1
In the above example, we used "W+/B" to select High intensity white letters
on blue background. So, when we see a character with that color on screen,
that character has an associated byte with the value:
xBase Color HardWare color Binary representation
=========== ============== =====================
"W+/B" 31 0 0 0 1 1 1 1 1
Lets analyze the above binary representation:
0 0 0 1 1 1 1 1 --> 0 0 0 1 1 1 1 1
7 6 5 4 3 2 1 0 No Back Blue Back Fore White Fore
( bits order ) Intensity color Intensity Color
See Also:
nColorToN()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson