Function: css--compute-color

css--compute-color is a byte-compiled function defined in css-mode.el.gz.

Signature

(css--compute-color START-POINT MATCH)

Documentation

Return the CSS color at point.

Point should be just after the start of a CSS color, as recognized by css--colors-regexp. START-POINT is the start of the color, and MATCH is the string matched by the regexp.

This function will either return the color, as a hex RGB string; or nil if no color could be recognized. When this function returns, point will be at the end of the recognized color.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/css-mode.el.gz
(defun css--compute-color (start-point match)
  "Return the CSS color at point.
Point should be just after the start of a CSS color, as recognized
by `css--colors-regexp'.  START-POINT is the start of the color,
and MATCH is the string matched by the regexp.

This function will either return the color, as a hex RGB string;
or nil if no color could be recognized.  When this function
returns, point will be at the end of the recognized color."
  (cond
   ((eq (aref match 0) ?#)
    (css--hex-color match))
   ((member match '("rgb(" "rgba("))
    (css--rgb-color))
   ((member match '("hsl(" "hsla("))
    (css--hsl-color))
   ;; Evaluate to the color if the name is found.
   ((css--named-color start-point match))))