How can I change (insert,delete,rename,…) the list of named colors?

I tried to edit /usr/share/emacs/25.3/lisp/term/tty-colors.el.gz and byte-compile after change, but it had no effect.

Note: I do not want to have another color picker, but change the builtin picker wich shows on list-colors-display or in Customization-context. I could live with an other color picker though, if it'd be very simmilar and also would replace the builtin color picker in every case…

Also I tried to get help on the variable defined-colors with C-h v defined-colors RET, but got no match - does that mean, there is just no help on this variable? Edit: Ok, this is bec. it's a function – but C-h f defined-colors RET also doesn't contain info on where the defined colors are stored and how they might be adjusted.

EDIT1 (after comment by jue): Tried to insert ("testcolor" 35980 65535 0) to tty-colors.el.gz and added "testcolor" at the end of the list x-colors in common-win.el.gz, byte-compiled both and restarted emacs - but still no "Testcolor" entry in *Colors*.

EDIT2 (after 2nd comment by jue): Only file named rgb.txt on my (arch linux) system is /usr/share/emacs/25.3/etc/rgb.txt I inserted 140 255 0 testcolor there (+ EDIT1) - still no entry.

EDIT3 …well maybe my desire to use the builtin color picker isn't very smart – I'll rather look for a color picker, that presents colors in a similar way and isn't bound to some X11 system file. I'll update, when I find something sufficient.

Still feel free to answer this exact question (as I'd love to gather insight to emacs), or suggest a color picker, that presents just a user defined list of colored color value entries.

  • 2
    have a look at file common-win.el, there is a list and the function xw-defined-colors which is called by defined-colors.
    – jue
    Feb 11, 2018 at 22:31
  • ty, but I don't see, how to add i.e. #ff6600 with name "FF6600". The hint in code mentions some `rgb.txt'-file - but I don't have a file named rbg.txt anywere
    – kai-dj
    Feb 11, 2018 at 22:41
  • With X11 (Unix) colors are defined in /usr/share/X11/rgb.txt.correct path might be slightly different on distributions.
    – jue
    Feb 12, 2018 at 7:32
  • 1
    The above mentioned rgb.txt on my system, is a link and points to /etc/X11/rgb.txt. Emacs list-colors-displayshows less colors than listed in this file. Maybe have another look at comon-win.el or faces.el? Did you restart your X11 server after changes of edit 1 and 2? (I'm also just guessing, though)
    – jue
    Feb 12, 2018 at 15:42
  • 1
    I had a look at Emacs c-source code. Emacs is fetching color values by name, either through GTK or X11 functions. It depends what Emacs you are using. So if you are using GTK-emacs try to define colors within gtk config. GTK version (2 or 3) matters. After this check within emacs with e.g. M-: (xw-color-values "white") for white color. If you see your color RGB values then try to manipulate the x-colors value. (I did not test this, nor do I know how to define colors within GTK, though). Also have a look at M-: (list-colors-display '("black" "DimGrey" "DimGray") nil nil).
    – jue
    Feb 12, 2018 at 21:49


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.