Skip to main content
2 of 4
added 107 characters in body
phils
  • 53.1k
  • 3
  • 84
  • 127

How about:

(defun my-insert-color-hex ()
  "Select a color and insert its hexadecimal format."
  (interactive "*")
  (let ((buf (current-buffer)))
    (list-colors-display
     nil nil `(lambda (name)
                (interactive)
                (quit-window)
                (with-current-buffer ,buf
                  (insert (apply 'color-rgb-to-hex
                                 (color-name-to-rgb name))))))))
phils
  • 53.1k
  • 3
  • 84
  • 127