I don't like the function that Customize uses to select color. It spawns a new buffer that messes up window configuration, and is also difficult to search.

I want to replace this function with the following:

(defun helm-insert-color-hex ()
  "Insert the hex value at point for the color selected via helm"
  (insert (apply 'color-rgb-to-hex (color-name-to-rgb (helm-colors)))))

How can I do this? I can't seem to find what that "Choose" button does (for example, when setting a foreground color for some face)

  • I couldn't understand your original question, so I rewrote it. If my new text isn't accurate, you can roll-back the change or make further edits. – Tyler Feb 17 '17 at 18:03

The function used to display the list of colors is list-colors-display. This function is actually called from the color widget, so that's the code you'll need to work with. Emacs widgets are documented in their own manual, available from Emacs via C-h i widget <ret>.

  • Great, thanks for the question and answer! – Dodgie Feb 17 '17 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.