mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.83k stars 710 forks source link

Default theme's colour constrast is kinda bad. #3554

Open ewtoombs opened 4 years ago

ewtoombs commented 4 years ago

screenshot_2020-06-14-055217

Am I alone in thinking this is really really hard to read?

Here's my fix.

--- /usr/share/kak/colors/default.kak   2020-01-16 11:46:42.000000000 +0000
+++ colors/default.kak  2020-06-10 15:12:27.702682333 +0000
@@ -1,4 +1,5 @@
 # Kakoune default color scheme
+# (With fg/bg contrast fixes.)

 # For Code
 face global value red
@@ -27,16 +28,16 @@

 # builtin faces
 face global Default default,default
-face global PrimarySelection white,blue+fg
-face global SecondarySelection black,blue+fg
+face global PrimarySelection black,blue+fg
+face global SecondarySelection black,green+fg
 face global PrimaryCursor black,white+fg
 face global SecondaryCursor black,white+fg
 face global PrimaryCursorEol black,cyan+fg
 face global SecondaryCursorEol black,cyan+fg
 face global LineNumbers default,default
 face global LineNumberCursor default,default+r
-face global MenuForeground white,blue
-face global MenuBackground blue,white
-face global MenuInfo cyan
+face global MenuForeground black,blue
+face global MenuBackground black,white
+face global MenuInfo black
 face global Information black,yellow
 face global Error black,red

Here's the result:

screenshot_2020-06-14-055127

lenormf commented 4 years ago

2020-06-14-103154_800x513_scrot

The problem might come from your terminal's default colours. It looks fine on mine.

ewtoombs commented 4 years ago

Well, looks like blue is showing up as dark purple on your terminal's default colours. I'd trust mine a bit more than yours given this. It shouldn't matter, though. You can not expect good contrast of colour foreground on colour background in general. Only colour on black or black on colour. My modified version will still work just fine on your suspiciously purple terminal.

Incidentally, though it isn't important, my terminal is alacritty and I have not modified its colour scheme.

Delapouite commented 4 years ago

I guess the default color-scheme was initially made to support a terminal with raw colors. In this case the blue/white contrast is high enough. But I agree than in other conditions that may not be suitable. image

Screwtapello commented 4 years ago

For whatever historical reasons, a bunch of terminals ship with a default colour scheme with poor contrast (dark-blue vs. black is a common problem) or merely unpleasant (like the yellow in Delapouite's screenshot). On the other hand, some terminals ship with really nice colour-schemes, like the Tango colour scheme that libVTE-based terminals use:

image

If your terminal's colour-scheme has poor contrast, or is not to your taste, the easiest thing to do is adjust the terminal, not each app inside the terminal. There's tons of great colour-schemes for Alacritty you can play with. Some of them get pretty wild, but if you're looking for something conservative I recommend Tango (pictured above) or the new Windows Console colour-scheme Campbell as starting points.

ewtoombs commented 4 years ago

Alacritty's default blue was set so bright to provide good contrast with black. If I lower it, other apps will start looking bad. Alacritty's default was already carefully chosen to agree as much as possible with all apps. It really seems to me that kakoune is the outlier. Making the changes I proposed won't break other terminals—it will only improve kakoune's appearance on Alacritty, and probably other terminals.

mawww commented 4 years ago

While I dont think the default colorscheme is any good (its just whatever did not hurt by eyes too much when I started adding colors to Kakoune), I'd be keener to have a clean, overall redesign than just small fixes here and there for specific colorschemes of specific terminal emulators.

For example if rxvt-unicode and xterm, the default blue and black colors dont work well together, I did not really notice in Kakoune because I already had configured rxvt-unicode with another blue color to fix that issue, if we are to touch the default colorscheme, I'd like this to be fixed as well.

Ideally we would try the colorscheme against most well established terminal emulators in their default configuration to ensure it is legible.

Also, in the meantime, Kakoune got support for bright colors, which are not part of ecma-48 but are still very widely supported, maybe we could use those ?

caksoylar commented 4 years ago

As a data point, here is the default colorscheme on the Windows 10 terminal (kakoune on WSL) with the default palette called Campbell: image

In this case white-on-blue is definitely better than black-on-blue. Actually, SecondarySelection is pretty invisible with that scheme. It looks much better if we define face global SecondarySelection white,bright-blue: image

itsfarseen commented 4 years ago

This is how default colors look in alacritty with One Dark theme. image

ewtoombs commented 4 years ago

IDK about such a total redesign, @mawww .

You only really run into problems when you try contrasting colour on colour. If you always put colour on black or black on colour, you can expect good results.

Except for the really old terminals like xterm, whose blue/black contrast isn't nearly high enough. But that's a problem with those old terminals. Besides, kakoune's default already relies on good blue black contrast for face global title blue and face global keyword blue, for instance. So, doesn't look like we're caring too much about those old terminals in any case.

ewtoombs commented 4 years ago

@happycoder97 can you try the same screenshot with my fix? You can put this

# Kakoune default color scheme
# (With fg/bg contrast fixes.)

# For Code
face global value red
face global type yellow
face global variable green
face global module green
face global function cyan
face global string magenta
face global keyword blue
face global operator yellow
face global attribute green
face global comment cyan
face global meta magenta
face global builtin default+b

# For markup
face global title blue
face global header cyan
face global bold red
face global italic yellow
face global mono green
face global block magenta
face global link cyan
face global bullet cyan
face global list yellow

# builtin faces
face global Default default,default
face global PrimarySelection black,blue+fg
face global SecondarySelection black,green+fg
face global PrimaryCursor black,white+fg
face global SecondaryCursor black,white+fg
face global PrimaryCursorEol black,cyan+fg
face global SecondaryCursorEol black,cyan+fg
face global LineNumbers default,default
face global LineNumberCursor default,default+r
face global MenuForeground black,blue
face global MenuBackground black,white
face global MenuInfo black
face global Information black,yellow
face global Error black,red
face global StatusLine cyan,default
face global StatusLineMode yellow,default
face global StatusLineInfo blue,default
face global StatusLineValue green,default
face global StatusCursor black,cyan
face global Prompt yellow,default
face global MatchingChar default,default+b
face global Whitespace default,default+f
face global BufferPadding blue,default

at ~/.config/kak/colors/default.kak and it will just work without further configuration.

itsfarseen commented 4 years ago

@ewtoombs, Yep. It works :) image

ewtoombs commented 4 years ago

IDK about such a total redesign, @mawww . You only really run into problems when you try contrasting colour on colour. If you always put colour on black or black on colour, you can expect good results. Except for the really old terminals like xterm, whose blue/black contrast isn't nearly high enough. But that's a problem with those old terminals. Besides, kakoune's default already relies on good blue black contrast for face global title blue and face global keyword blue, for instance. So, doesn't look like we're caring too much about those old terminals in any case.

What I mean to say, @mawww, is that this should be the last thing you'll have to do to the default theme for quite a while.

kaddkaka commented 2 years ago

Default theme for me looks like this and it's unreadable:

vmIxmEg

This is on a fresh install of Xubuntu using the default terminal in xfce: TerminalEmulator.

Screwtapello commented 2 years ago

It looks like xfce's TerminalEmulator defaults to a legacy-compatibility configuration with:

The CGA 16-colour palette isn't terrible, although it's not really designed to ensure arbitrary colour combinations will be readable.

Rendering "bold" text as "bright" was a reasonable choice when computers couldn't render different fonts and when we only had 16 colours to work with, but today when we have thousands of fonts and millions of colours, it's not that useful. And since it tends to produce unexpected colour combinations, it's a particularly bad idea in combination with the CGA palette.

It would be more compatible to just ensure that Kakoune never, ever used "bold" anywhere, in case somebody was using a 1980s terminal (or a modern terminal configured that way), but given there's only a few ways to emphasise a monospaced font, it's painful to give any of them up.

ewtoombs commented 2 years ago

Default theme for me looks like this and it's unreadable:

vmIxmEg

This is on a fresh install of Xubuntu using the default terminal in xfce: TerminalEmulator.

How does it look when you use my fix?

lobre commented 11 months ago

For a new user that opens a new text editor for the first time, the colorscheme plays an essential role in the first impression. I have had really bad xp with helix or vis for instance when trying them for the first time. And if the first thing I have to do is to tweak my configuration to make it look "right", it is a problem in my opinion. It blocks me in the flow of discovery of the editor and tells me that developers probably don't care enough about polishing it (this might be wrong in practice, but it is what it feels like at least).

For kakoune, it is not that bad except for this precise issue about the contrast. I would be nice to have it tackled, even if it is kind of hard to have a good enough experience for all terminal emulators.

The above fix given by @ewtoombs works well for xfce terminal at least.