emacs-color-themes icon indicating copy to clipboard operation
emacs-color-themes copied to clipboard

Color themes look weird on the comandline GNU emacs

Open amukiza opened this issue 10 years ago • 6 comments

When I use the color themes on the GUI Emacs, everything looks great but unfortunately I love using emacs in the comandline more than the GUI. Is there a way I fix my emacs (command line) to work well with these awesome colors?

amukiza avatar Nov 16 '14 11:11 amukiza

Hi. This is something I've been meaning to fix for a while. I will look into fixing these color themes for terminal Emacs.

owainlewis avatar Nov 16 '14 18:11 owainlewis

+1. This is an awesome repo. Would love to use it in the command line.

collenjones avatar Nov 23 '14 21:11 collenjones

@purcell Any ideas on this?

owainlewis avatar Nov 24 '14 20:11 owainlewis

These themes currently tell Emacs that - whatever the colour capabilities of the current frame - it should use the exact hex colours you've supplied. (That's what the t means on lines like this.)

In GUI frames, you'll get the desired result, and in terminal frames, you'll get results that vary in all sorts of... interesting ways. If you use a 256-colour terminal, the hex colours will (I believe) be rounded to the nearest colour in the 256-colour palette. If it's a 16-colour palette, then the rounding is more acute. (Note also that applying a "theme" in the terminal emulator will generally change the 16-colour palette.)

If this issue is about the colours not being exactly right in a 256-colour terminal, well, that can never be fixed, because there are only 256 colours available. But it's possible (and likely) that the themes don't look good in a regular 16-colour ansi terminal, and that can be addressed.

So the correct (and OCD) way to fix this would be to specify two sets of attributes for face each face definition: each would have a different class specifier in order to target either terminal or GUI frames, and would have a different hex colour.

e.g.

(hl-line ((t (:background ,hickey-light-gray))))

might end up something like this:

(hl-line (((min-colors 89) (:background ,hickey-light-gray)) ; 256-colour and GUI
          (t               (:background gray))))             ; low-colour terminals

There's more about this in the elisp manual: https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Faces.html

purcell avatar Nov 24 '14 20:11 purcell

Awesome thanks. I knew you were the guy to ask :+1:

owainlewis avatar Nov 24 '14 20:11 owainlewis

I see my reputation exceeds me. ;-)

purcell avatar Nov 24 '14 21:11 purcell