Function: color-defined-p

color-defined-p is a byte-compiled function defined in faces.el.gz.

Signature

(color-defined-p COLOR &optional FRAME)

Documentation

Return non-nil if COLOR is supported on frame FRAME.

COLOR should be a string naming a color (e.g. "white"), or a string specifying a color's RGB components (e.g. "#ff12ec"), or the symbol unspecified.

This function returns nil if COLOR is the symbol unspecified, or one of the strings "unspecified-fg" or "unspecified-bg".

If FRAME is omitted or nil, use the selected frame.

View in manual

Probably introduced at or before Emacs version 21.1.

Aliases

x-color-defined-p (obsolete since 30.1) viper-color-defined-p (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/faces.el.gz
(defun color-defined-p (color &optional frame)
  "Return non-nil if COLOR is supported on frame FRAME.
COLOR should be a string naming a color (e.g. \"white\"), or a
string specifying a color's RGB components (e.g. \"#ff12ec\"), or
the symbol `unspecified'.

This function returns nil if COLOR is the symbol `unspecified',
or one of the strings \"unspecified-fg\" or \"unspecified-bg\".

If FRAME is omitted or nil, use the selected frame."
  (unless (member color '(unspecified "unspecified-bg" "unspecified-fg"))
    (if (display-graphic-p frame)
	(xw-color-defined-p color frame)
      (numberp (tty-color-translate color frame)))))