Go to the first, previous, next, last section, table of contents.


Color Names

Function: x-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. You can ask for any defined color on any kind of display, and you will get some result--that is how the X server works. Here's an approximate way to test whether your display supports the color color:

(defun x-color-supported-p (color &optional frame)
  (and (x-color-defined-p color frame)
       (or (x-display-color-p frame)
           (member color '("black" "white"))
           (and (> (x-display-planes frame) 1)
                (equal color "gray")))))

Function: x-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. If color is not defined, the value is nil.

(x-color-values "black")
     => (0 0 0)
(x-color-values "white")
     => (65280 65280 65280)
(x-color-values "red")
     => (65280 0 0)
(x-color-values "pink")
     => (65280 49152 51968)
(x-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.


Go to the first, previous, next, last section, table of contents.