[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

29.19 Color Names

These functions provide a way to determine which color names are valid, and what they look like. In some cases, the value depends on the selected frame, as described below; see 29.9 Input Focus, for the meaning of the term "selected frame".

Function: color-defined-p color &optional frame
This function reports whether a color name is meaningful. It returns t if so; otherwise, nil. The argument frame says which frame's display to ask about; if frame is omitted or nil, the selected frame is used.

Note that this does not tell you whether the display you are using really supports that color. When using X, you can ask for any defined color on any kind of display, and you will get some result--typically, the closest it can do. To determine whether a frame can really display a certain color, use color-supported-p (see below).

This function used to be called x-color-defined-p, and that name is still supported as an alias.

Function: defined-colors &optional frame
This function returns a list of the color names that are defined and supported on frame frame (default, the selected frame).

This function used to be called x-defined-colors, and that name is still supported as an alias.

Function: color-supported-p color &optional frame background-p
This returns t if frame can really display the color color (or at least something close to it). If frame is omitted or nil, the question applies to the selected frame.

Some terminals support a different set of colors for foreground and background. If background-p is non-nil, that means you are asking whether color can be used as a background; otherwise you are asking whether it can be used as a foreground.

The argument color must be a valid color name.

Function: color-gray-p color &optional frame
This returns t if color is a shade of gray, as defined on frame's display. If frame is omitted or nil, the question applies to the selected frame. The argument color must be a valid color name.

Function: color-values color &optional frame
This function returns a value that describes what color should ideally look like. If color is defined, the value is a list of three integers, which give the amount of red, the amount of green, and the amount of blue. Each integer ranges in principle from 0 to 65535, but in practice no value seems to be above 65280. This kind of three-element list is called an rgb value.

If color is not defined, the value is nil.

 
(color-values "black")
     => (0 0 0)
(color-values "white")
     => (65280 65280 65280)
(color-values "red")
     => (65280 0 0)
(color-values "pink")
     => (65280 49152 51968)
(color-values "hungry")
     => nil

The color values are returned for frame's display. If frame is omitted or nil, the information is returned for the selected frame's display.

This function used to be called x-color-values, and that name is still supported as an alias.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on May 2, 2002 using texi2html