vim / colorschemes

colorschemes for Vim
289 stars 23 forks source link

The elflord remake looks very different from the original #269

Open GergelyKalmar opened 1 month ago

GergelyKalmar commented 1 month ago

I really like the idea of modernizing the 20+ year old color schemes, in particular, adding support for newer Vim features, however, the new elflord remake looks so different from how the original looked that it should probably be just a separate color scheme. Here is an example of how the legacy elflord renders in Gnome Terminal with a green on black theme:

image

Here is how it looks with the new elflord scheme:

image

I would love having a remake that works more like the original (which followed the terminal theme for the default text color and did not interfere with the Terminal background transparency either). It feels like a major backwards incompatible change, and while it's great that there is a way to get the "legacy" color schemes back, I think some may have been retired prematurely.

romainl commented 1 month ago

When we started our work on the legacy colorschemes, the biggest challenge we faced was that all of them where actually very badly designed. Lack of consistency was the most common problem and elflord happened to be one of the worst, if not the worst in that respect. For example, here is how elflord handles the Statement highlight group:

hi Statement term=bold      ctermfg=Yellow gui=bold guifg=#aa4444

For reference, this is how #aa4444 looks:

#aa4444

and this is how Yellow looks in the default xterm palette:

#cdcd00

and, of course, Yellow can look like anything depending on the user's terminal palette. Hell, it may even have been set to #aa4444 in the author's palette, which would actually make elflord quite consistent, for some meaning of "consistent". Who knows?

The general approach when designing colorschemes is to start with the highest definition (GUI, millions of colors) and work your way to the lowest acceptable definition, which can vary from project to project. In web development circles, it is called "graceful degradation". That is also the approach we chose for the remakes: we started from the highest definition information available and tried as best as we can to stay close to it in lesser environment. Loss and deviation are sadly unavoidable in that context but I think we did a pretty good job over all.

After the initial facepalm, we approached elflord like we approached all the others:

We didn't do it the other way around, from lesser environment to better environments, because how a given color looks in 8c or 16c is intrinsically tied to the user's terminal palette. Yellow can mean #cdcd00 with the default xterm palette or #b58900 with Solarized, etc. How can we infer a "correct" guifg value if the initial information, Yellow, is essentially meaningless? Thankfully, the author gave us #aa4444, whose precision and explicitness make for a more reasonable and dependable starting point.

We also didn't follow the original's "system" because it was inconsistent and inconsistency is what we were set out to fix.

In the case of Statement in elflord, this is what we came up with:

Basically, we favored a) consistency across environments over fidelity with the original, and b) fidelity with the GUI over fidelity with the TUI. To that end, we based on our choices on what we could make of the author's intent: from the GUI colors when available.

The net result is a vastly improved experience across environments (from left to right: 16c, 256c, GUI):

screen

at the expense of fidelity with the original, which looked different for everyone to begin with.

For comparison, this is a screenshot of the original elflord in GUI on the left and the remake in GUI on the right:

og and remake

All that to say that it will be very hard to convince us of the necessity to make elflord broken again. But feel free to unfix it as you which. I guess you can use the template in this repo as a starting point, or follow the instructions under :help colorscheme-override.

GergelyKalmar commented 1 month ago

That all sounds very reasonable. However, it does not change the fact that this theme has changed quite drastically for probably most terminal users (unless they indeed had weird color mappings).

Note that having a terminal version that is less forceful about colors was a feature, not a bug, to me. The previous elflord scheme was very careful about colors, and it picked up the main color theme of my terminal very nicely, which resulted in a very consistent experience when considering the entire experience of working in the terminal. While I understand that the new theme looks more consistent in isolation, it is now practically impossible to find a color scheme that is consistent with even the simplest terminal color schemes.

It must also be said that using GUI Vim is probably very different from using Vim in the terminal, therefore I'm still not sure that throwing away the terminal color schemes completely was a wise decision.

lifepillar commented 1 month ago

it is now practically impossible to find a color scheme that is consistent with even the simplest terminal color schemes.

The old color schemes were mostly “chameleon” color schemes: although you describe that as a feature, other people (myself included) would find that unintuitive, and often annoying because that “feature” might result in unreadable text with a change of environment (try using Elford when your terminal uses Solarized Light…).

It is basically impossible to design a color scheme by describing that the text should use color “zero”, comments color “nine’, and error messages color “one”, where “zero”, “nine”, and “one” can be literally anything. How do you even address a user wanting more contrast or a different color for comments when you have no idea how that user's version of the color scheme looks like, and, most importantly, without breaking the other zillions versions of the remaining users?

The path that was taken—namely, let the color schemes have a consistent appearance within the limitations of the 256 color palettes, and freeze the legacy color schemes—was the only sensible thing to do.

And I've said frozen: the old color schemes were not “thrown away completely”. You may grab the legacy elford from this repo and put it your Vim folder. The legacy colors are even available as a plugin.

lifepillar commented 1 month ago

Yet another option to try:

:set t_Co=16
:colorscheme elford

Where, in this case, you'd be using the new elford that comes with Vim.

GergelyKalmar commented 1 month ago

It is basically impossible to design a color scheme by describing that the text should use color “zero”, comments color “nine’, and error messages color “one”, where “zero”, “nine”, and “one” can be literally anything. How do you even address a user wanting more contrast or a different color for comments when you have no idea how that user's version of the color scheme looks like, and, most importantly, without breaking the other zillions versions of the remaining users?

It clearly isn't impossible to design such a color scheme, someone has already done it in the past :). Perhaps they had different requirements in mind, but surely their design has some usefulness to it too. To respond to your question: if the user wants more contrast in a "chameleon" scheme, they can just adapt their terminal color scheme, and suddenly they solved their contrast problems for all well-behaving apps in the terminal. It is a very useful feature!

I don't mind either way, although I would have loved if the "chameleon" terminal version of the theme was maintained as part of Vim proper (perhaps with a different name). Sure, I can download the old color files from anywhere, but if there is all this effort in improving Vim's color schemes, I thought perhaps we can think about and design for the use cases that chameleon schemes solve, too.

romainl commented 1 month ago

It clearly isn't impossible to design such a color scheme, someone has already done it in the past :).

All the built-in colorschemes, including default, are "chameleons" if you have a 16-colors or 8-colors $TERM. We didn't change that at all because it simply can't be changed.

From a designer perspective, the main challenge posed by those environments is not the limited palette but the fact that there is no way to control that palette from within Vim.

In the richest environments (GUI and in "true colors" terminals), the designer can reasonably assume that the specific "dark red" that he wants for Statement will look the same for everyone.

In more limited environments (say 256-colors terminals), the designer can still pick an actual "dark red" and, again, be reasonably confident in the outcome, but it may not necessarily be exactly the same as the one he would have chosen for the GUI.

In even more limited environments (16colors/8-colors terminals), all the designer can hope is that the color attributed to 1 or darkred by the user in his terminal's palette is in fact some kind of "dark red". When working within those constraints, there are two possible strategies:

The original author of Elflord clearly chose the latter (and he did that for a few other legacy colorschemes)… and you are one of the lucky few for whom it worked. In our opinion, that strategy is selfish and short-sighted, and can only result in colorschemes that may work for some while being broken for most. For the remakes and the new ones, we opted for the former strategy, in combination with the "graceful degradation" I mentioned earlier, whose outcome is colorschemes that work equally well for most but may not work as well for some. This, in our opinion, is how a built-in colorscheme should work.

Regarding @lifepillar's mention of Solarized Light, here is a screenshot taken with a 16colors $TERM to illustrate the point:

Capture d’écran 2024-10-27 à 09 03 11

Again, we won't re-break Elflord or adjust it to one user's terminal palette.

The original is still available if you want, and you are free to do what we all end up doing at some point: write your own variation of your favorite colorscheme. If you want to take that route, the template at colortemplate/elflord.colortemplate is a good starting point because it supports all the modern features that the original didn't and is guaranteed to generate a working colorscheme. The actual stylistic changes we made to ensure internal consistency are very few so it shouldn't take too long to have your own Elflord clone. Hell, you can even ping us if you need help and submit it for inclusion (with a different name, "chameleon" sounds good) when it is ready.