Closed jcaw closed 5 years ago
It may be possible to solve this issue in tandem with #4
The original version of theme-magic
tried to extract its colors from the current Emacs faces. It would iterate through them, extract the colors, and create a theme. This was prone to failure, because different themes use different color standards for each face. For example, it would fail on monokai
and output a theme with only 4 colors.
I developed a heuristic to get around this (basically: try many different faces until we get a vibrant palette), but never finished implementing it because the ANSI approach was so much simpler. It may be possible to revive this approach and combine it with the ANSI method (or provide it as an optional fallback).
Working on this and #4 on branch reimplementing_font_extraction
(Visual examples included below - they may be easier to understand)
Problem
Most themes that set ANSI colors use the standard color order:
Meaning they will set ANSI color 0 to black, 1 to red, 2 to green, 4 to blue, etc. Almost all themes use this ordering. This means the ANSI colors don't reflect any kind of color dominance. If the Emacs theme uses purple as its dominant color, the ordering of the ANSI colors will not reflect this.
This means the exported theme will not look cohesive for some themes. Two problems become obvious:
Examples
This behaviour works well for some themes, such as
zenburn
:However, it doesn't work for others.
spacemacs-dark
is designed to use purple as its dominant color - this look is lost when it's exported - everything becomes blue and cyan.Some themes use non-standard ANSI colors, presumably to get around this problem. These tend to look good. For example,
creamsody
:Some themes look awful. This is
cherry-blossom
:Solution
Ideally, the exported theme should somehow reflect the dominant colors of the Emacs theme. If the theme is mainly purple, purple should be dominant. If the theme is monocolor, the different gradients should be reflected instead of just the named ANSI colors.
The obvious solution would be to re-order the colors. Instead of exporting colors in the standard ANSI order,
theme-magic
should place the dominant colors in the most-used slots. For example, thespacemacs-dark
theme should put purple in the blue or cyan slot, since it's used the most.A heuristic would need to be developed that could do this.