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 Fl_Color in an internal table of 256 colors, called the "fltk
colormap", shown here. Thus using any integer in the range 0-255 as
an Fl_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 Fl_Color of zero (FL_NO_COLOR
) will draw black but
is ambiguous. It is returned as an error value or to indicate
portions of a Fl_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 FL_BLACK
(56)
to get black.
The entries 1-31 in the colormap are settable by the user program. The advantage of using these over fl_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 fl_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 other user preferences so that the entry FL_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 fl_rectf()
on 8-bit screens. In addition the symbols FL_BLACK, FL_RED,
FL_GREEN, FL_YELLOW, FL_BLUE, FL_MAGENTA, FL_CYAN, FL_WHITE, and
FL_BLUE_SELECTION_COLOR
index the corners of the cube (these
have different values than fltk1.0!).
weight*A+(1-weight)*B
.
fl_inactive(c)
if the bit
FL_INACTIVE
is turned on in f, otherwise c
is returned unchanged.
FL_NO_COLOR
or FL_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.
FL_NUM_GRAY
(24) shades in
the gray ramp, with zero being black and 23 being white.
fl_rgb(r,g,b)
, which takes 8-bit numbers. The three
arguments are indexes into the cube (not 8 bit numbers!), the number
of values in each index is FL_NUM_RED
(5),
FL_NUM_GREEN
(8) and FL_NUM_BLUE
(5).