The (low) 4 bytes of the color are rgbN. (r is the byte with the highest value, not the first in memory. On an Intel or other little-endian machine the first byte in memory is N, while on a big-endian machine such as a MIPS it is r)
If the rgb is
zero, the N is the color "index". This index is used to look
up an fltk::Color in an internal table of 255 colors, called the "fltk
colormap", shown here. Thus using any integer in the range 1-255 as
an fltk::Color will index the colormap. If rgb is not zero the
index value is ignored (future code may treat the last byte as an
"alpha" value).
An fltk::Color of zero (fltk::NO_COLOR
) will draw black but
is ambiguous. It is returned as an error value or to indicate
portions of a fltk::Style that should be inherited, and it is also used
as the default label color for everything so that changing color zero
can be used by the -fg switch. You should use fltk::BLACK
(56)
to get black.
The entries 1-31 in the colormap are settable by the user program. The advantage of using these over fltk::rgb(r,g,b) is that they are reproduced exactly on 8-bit screens (normal rgb colors are selected on 8-bit screens by using fltk::nearest_color()). Colors 1-15 are preset for back compatability but fltk no longer uses these so you can change them.
Entries 32-55 of the colormap are a 24-entry "gray ramp". This ramp is modified by the -bg switch or by other code that calls fltk::background() so that the color fltk::GRAY (49) is the background color, and the others are a nice range from black to white. These are used to draw box edges.
The remiander of the colormap is a 5x8x5 color cube. This cube is
used to dither images or fltk::rectf()
on 8-bit screens. In addition the symbols fltk::BLACK, fltk::RED,
fltk::GREEN, fltk::YELLOW, fltk::BLUE, fltk::MAGENTA, fltk::CYAN, fltk::WHITE, and
fltk::BLUE_SELECTION_COLOR
index the corners of the cube (these
have different values than fltk1.0!).
weight*A+(1-weight)*B
.
fltk::inactive(c)
if the bit
fltk::INACTIVE
is turned on in f, otherwise c
is returned unchanged.
fltk::NO_COLOR
or fltk::WHITE
, whichever one is more different than
bg. This function is often used by fltk for labels and text
when no color is specified in the style.
fltk::GRAY
is set the the rgb values of the passed color.
This is the best way to change the overall color of your application,
because it sets all the shaded borders and works on 8-bit screens.