owainlewis / emacs-color-themes

A collection of custom themes for Emacs. All the themes are named after famous programmers.
Other
497 stars 55 forks source link

Color themes look weird on the comandline GNU emacs #23

Open amukiza opened 9 years ago

amukiza commented 9 years ago

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?

owainlewis commented 9 years ago

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

collenjones commented 9 years ago

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

owainlewis commented 9 years ago

@purcell Any ideas on this?

purcell commented 9 years ago

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

owainlewis commented 9 years ago

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

purcell commented 9 years ago

I see my reputation exceeds me. ;-)