Skip to content

Can we fix the default colorscheme ? #250

@neutaaaaan

Description

@neutaaaaan

This post is motivated by this now closed pull request from chrisbra.
I figured that if one of vim's core devs had such different expectations from vim's colorschemes than what they actually are, and have been for 2 decades, issues such as the one highlighted here are likely to have gone unnoticed.

What we currently call "the default colorscheme" is the byproduct of several things :

  • the various broken implementations of seemingly unrelated colorschemes that share the same name
  • vim failing to autodetect the user's terminal background color over ssh and defaulting to the light version
  • distro maintainers doing the usual distro maintainer shuffle to work around perceived issues with vim's default config

As I myself get to use "the default colorscheme" pretty much all day long at work, through various environments, versions of vim, and distributions, I've grown to absolutely abhor it.
Not because it's bad per se, but because the user experience is utterly inconsistent.

There's very little that could be done about the 24bit version without effectively breaking it. It's trash, and I don't even care.
The terminal versions, especially the 256c one, could use a lot of tweaking, to fix design decisions that only make sense within the context of the default xterm palette, or to restore functionalities that break over ssh.

The goal of this post is to figure out if a third colorscheme could be implemented within vim as a fallback when it fails to autodetect the background color. This colorscheme would be based upon the light version, which is the actual default colorscheme.

I believe it is viable, because this version of the colorscheme does so many things wrong that they right themselves.

I'll use screenshots from an xterm analogue, quiet (itself essentially a more legible xterm analogue), a gruvbox analogue, and because I think it's fair to acknowledge that there is no silver bullet, a solarized analogue.

All the makeshift modifications displayed in this post will use similar design rules to what I've used in quiet or sorbet :

  • I don't mind using different palettes for elements that I don't expect to stay on screen very long, or that are contextually different enough from the buffer being displayed.
  • There is no code highlighting within diffs, selections or searches, as this only creates issues

I use rxvt-unicode and tmux, both configured proprely to use the extended 256c palette.
Here are the aliases used to get vim into the same state it'd be over ssh without a config file:
vim -u NONE +"set nocp" +"syntax on" +"set background=light"
vimdiff -u NONE +"set nocp" +"syntax on" +"set background=light"

Most of the main highlighting palette uses ansi colors, except for spotfixes in places where I believe the default xterm ansi colors really didn't work out, such as the Statement group, and diffs.

Here's what the light version of default looks like, peering at a spot in a random file that contains a bunch of statements:
xterm256c
quiet256c
gruvbox256c
solarized256c

The fact that bad colors were picked 30 years ago for one terminal emulator's ansi palette shouldn't hinder vim users in 2023.
Remarkably, whoever made this tweak, effectively did what most colorscheme/theme authors seem to do : use orange as a proxy for yellow.
Here's what this looks like with Statement pointing to ansi3:
xterm256c_statement
quiet256c_statement
gruvbox256c_statement
solarized256c_statement

Diffs are plain broken.
They rely on the extended 256c palette but still use the ansi palette for DiffText, which ends up being completely illegible.
They also try to preserve syntax highlighting inside diffed elements, which simply cannot work in this context.
xterm256c_diff
quiet256c_diff
gruvbox256c_diff
solarized256c_diff

There's little point trying to move away from the 256c when it comes to diff. Having its ozn palette is fine, it's the behaviour that's busted and ought to be fixed:
xterm256c_diff_coherent
quiet256c_diff_coherent
gruvbox256c_diff_coherent
solarized256c_diff_coherent

Visual selections are broken. We can't rely on fg/bg being different, or even different enough from ansi7 to be legible.
This happens to me on a daily basis:
xterm256c_visual
quiet256c_visual
gruvbox256c_visual
solarized256c_visual

Fixing this requires bolting selections down to a single color:
xterm256c_visual_coherent
quiet256c_visual_coherent
gruvbox256c_visual_coherent
solarized256c_visual_coherent

Search results are kinda crap for similar reasons:
xterm256c_search
quiet256c_search
gruvbox256c_search
solarized256c_search

And the situation can be remedied somewhat by bolting the color down.
xterm256c_search_coherent
quiet256c_search_coherent
gruvbox256c_search_coherent
solarized256c_search_coherent

This is far from being complete and is just meant to get the ball rolling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions