Function: css--named-color-to-hex

css--named-color-to-hex is a byte-compiled function defined in css-mode.el.gz.

Signature

(css--named-color-to-hex)

Documentation

Convert named CSS color at point to hex format.

Return non-nil if a conversion was made.

Note that this function handles CSS colors specifically, and should not be mixed with those in color.el.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/css-mode.el.gz
(defun css--named-color-to-hex ()
  "Convert named CSS color at point to hex format.
Return non-nil if a conversion was made.

Note that this function handles CSS colors specifically, and
should not be mixed with those in color.el."
  (save-excursion
    (unless (or (looking-at css--colors-regexp)
                (eq (char-before) ?#))
      (backward-word))
    (when (member (word-at-point) (mapcar #'car css--color-map))
      (looking-at css--colors-regexp)
      (let ((color (css--compute-color (point) (match-string 0))))
        (replace-match (css--format-hex color)))
      t)))