jcaw / theme-magic

🎨 Apply your Emacs theme to the rest of Linux, using magic. Also works on Mac.
GNU General Public License v3.0
141 stars 4 forks source link

Extract theme colors dynamically, from the current fonts #5

Closed jcaw closed 5 years ago

jcaw commented 5 years ago

Currently, theme-magic extracts its colors from Emacs' ANSI color vector, which is defined by the current theme. This creates two main problems:

  1. (Issue #3) When set, the colors in this vector tend to match the named ANSI colors (e.g. color 1 is a shade of red, 2 is a shade of green, etc). This can produce nice results, but it means terminals may end up with a completely different set of dominant colors. For example, in Emacs yellow and green may be the dominant colors. In the exported theme, it's likely to be blue and cyan. So Emacs looks yellow and green, while terminals look blue and cyan.
  2. (Issue #4) Some themes don't set the ansi colors, so the exported themes are wrong. They don't match.

This pull request changes the way theme colors are chosen. It uses various heuristics to pull colors out of the current fonts, which should match the current theme. The results are much nicer, they match Emacs much more closely, and this approach should be compatible with all themes.

Note that these methods are not yet documented properly - the functionality is there, but the documentation needs to be written.

Closes #3 Closes #4