Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Fl_Color Functions


Defines

#define FL_NUM_GRAY   24
 Number of colors in gray ramp.

#define FL_NUM_GREEN   8
#define FL_GREEN_DELTA   1
#define FL_NUM_RED   5
#define FL_RED_DELTA   8
#define FL_NUM_BLUE   5
#define FL_BLUE_DELTA   40

Typedefs

typedef unsigned Fl_Color

Enumerations

enum  Colors {
  FL_NO_COLOR = 0, FL_GRAY_RAMP = 32, FL_GRAY = 49, FL_INACTIVE_COLOR = 39,
  FL_COLOR_CUBE = 0x38, FL_BLACK = 0x38, FL_RED = 0x58, FL_GREEN = 0x3f,
  FL_YELLOW = 0x5f, FL_BLUE = 0xd8, FL_MAGENTA = 0xf8, FL_CYAN = 0xdf,
  FL_WHITE = 0xff, FL_GRAY0 = 32, FL_DARK3 = 39, FL_DARK2 = 45,
  FL_DARK1 = 47, FL_LIGHT1 = 51, FL_LIGHT2 = 53, FL_LIGHT3 = 55,
  FL_SELECTION_COLOR = FL_GRAY, FL_FREE_COLOR = 16, FL_BLUE_SELECTION_COLOR = 0x88, FL_INVALID_COLOR = 0xFFFFFFFE
}
 Pre-defined colors. More...


Functions

Fl_Color fl_gray_ramp (int i)
 Returns a gray color value from black (i == 0) to white ( i == FL_NUM_GRAY - 1). More...

Fl_Color fl_color_cube (int r, int g, int b)
 fl_color_cube.

Fl_Color fl_rgb (unsigned char r, unsigned char g, unsigned char b)
 Returns Fl_Color of r,g,b.

FL_API Fl_Color fl_rgb (const char *color)
 Returns Fl_Color from string e.g. More...

FL_API Fl_Color fl_color_average (Fl_Color c1, Fl_Color c2, double weight)
 Returns the weighted average color between the two colors. More...

FL_API Fl_Color fl_inactive (Fl_Color color)
 Returns "greyed" color between 'color' and FL_GRAY.

FL_API Fl_Color fl_inactive (Fl_Color color, Fl_Flags f)
 Returns "greyed" color between 'color' and FL_GRAY. More...

FL_API Fl_Color fl_contrast (Fl_Color fg, Fl_Color bg)
 Decides if 'fg' can be seen against 'bg' and returns 'fg' if so. More...

FL_API Fl_Color fl_invert (Fl_Color color)
 Returns inverted color of 'color'.

FL_API Fl_Color fl_get_color (Fl_Color color)
 Turns an indexed color into an rgb color by looking it up in the colormap. More...

FL_API void fl_get_color (Fl_Color c, uchar &r, uchar &g, uchar &b)
 Turns an indexed color into an rgb color if necessary, and then the rgb portions of the color are extracted and put in the passed variables (r,g,b).

FL_API void fl_set_color (Fl_Color index, Fl_Color color)
 Set entry index in the eFLTK colormap. More...

FL_API void fl_free_color (Fl_Color c)
 Tell a colormapped-display that we don't need this indexed color anymore. More...

FL_API void fl_background (Fl_Color)
 Modifies the "gray ramp" in the eFLTK colormap so that the color FL_GRAY is set the the rgb values of the passed color. More...

FL_API Fl_Color fl_nearest_color (Fl_Color color)
 Turns an rgb color into an indexed color. More...

Fl_Color fl_lighter (Fl_Color c)
 Returns a lighter version of the specified color.

Fl_Color fl_darker (Fl_Color c)
 Returns a darker version of the specified color.


Enumeration Type Documentation

enum Colors
 

Pre-defined colors.

The following color constants can be used to access the colors from the eFLTK standard colormap:

Enumeration values:
FL_GRAY  'R' default color, 75%.
FL_INACTIVE_COLOR  same as fl_inactive(FL_BLACK).
FL_GRAY0  'A' black.
FL_DARK3  'H' about 33%.
FL_DARK2  'N'.
FL_DARK1  'P' about 66%.
FL_LIGHT1  'T'.
FL_LIGHT2  'V'.
FL_LIGHT3  'X' white.
FL_BLUE_SELECTION_COLOR  WIN32-like selection color.
FL_INVALID_COLOR  Fl_Group default color, it means dont draw background.

Definition at line 39 of file Fl_Color.h.


Function Documentation

FL_API void fl_background Fl_Color   
 

Modifies the "gray ramp" in the eFLTK colormap so that the color FL_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.

FL_API Fl_Color fl_color_average Fl_Color    c1,
Fl_Color    c2,
double    weight
 

Returns the weighted average color between the two colors.

The red, green, and blue values are averaged using the following formula:

color = c1 * weight + c2 * (1 - weight)
Thus, a weight value of 1.0 will return the first color, while a value of 0.0 will return the second color.

FL_API Fl_Color fl_contrast Fl_Color    fg,
Fl_Color    bg
 

Decides if 'fg' can be seen against 'bg' and returns 'fg' if so.

If not this returns either FL_NO_COLOR or FL_WHITE, whichever one is more different than 'bg'. This function is often used by eFLTK for labels and text when no color is specified in the style.

FL_API void fl_free_color Fl_Color    c
 

Tell a colormapped-display that we don't need this indexed color anymore.

eFLTK will free any hardware colormap it allocated so that it can be reused by this or another program.

FL_API Fl_Color fl_get_color Fl_Color    color
 

Turns an indexed color into an rgb color by looking it up in the colormap.

If 'color' is not an indexed color it is returned unchanged.

Fl_Color fl_gray_ramp int    i [inline]
 

Returns a gray color value from black (i == 0) to white ( i == FL_NUM_GRAY - 1).

FL_NUM_GRAY is defined to be 24 in the current eFLTK release. To get the closest eFLTK gray value to an 8-bit grayscale color 'I' use:

fl_gray_ramp(I * (FL_NUM_GRAY - 1) / 255)
Parameters:
i  index of gray color: 0 to (FL_NUM_GRAY-1)

Definition at line 79 of file Fl_Color.h.

FL_API Fl_Color fl_inactive Fl_Color    color,
Fl_Flags    f
 

Returns "greyed" color between 'color' and FL_GRAY.

Only if flags 'f' has FL_INACTIVE bit set.

FL_API Fl_Color fl_nearest_color Fl_Color    color
 

Turns an rgb color into an indexed color.

If 'color' is already an indexed color it is returned unchanged. Otherwise, the closest color from the color cube is returned.

FL_API Fl_Color fl_rgb const char *    color
 

Returns Fl_Color from string e.g.

"FF0000", which is same as "red". If color is not found, 0 is returned.

FL_API void fl_set_color Fl_Color    index,
Fl_Color    color
 

Set entry index in the eFLTK colormap.

Parameters:
color  is changed to colormap. $param index must be in the range 1-31.


Generated on Thu Jul 31 15:33:58 2003 for eFLTK by doxygen1.2.15