Mange / tydra

Shortcut menu-based task runner, inspired by Emacs Hydra
MIT License
42 stars 4 forks source link

Use bold or bright color sequences (or both) for better legibility of shortcut characters #21

Open ngirard opened 4 years ago

ngirard commented 4 years ago

Using Ubuntu 19.04. There seems to be a problem specific to Konsole when displaying colors. Colors are displayed just fine on Xterm, Gnome-terminal and Alacritty. However, here's a screenshot of what Konsole 19.04.3 outputs using your own main.yml file as a test file: image The 'yellow' color is displayed in orange, making it difficult to differentiate from the 'red' color. I did nothing special with my configuration. The relevant environment variables are:

TERM=xterm-256color
COLORTERM=truecolor
Mange commented 4 years ago

Can you confirm that your current Konsole profile isn't just using orange as the yellow color, either when normal, bold, italic, dim, or bright?

I'm just using the standard ANSI 8 colors so the actual color should only be controlled by the terminal theme.

ngirard commented 4 years ago

So, after digging into Konsole color schemes and Ansi escape codes (yay!), it appears that virtually all the default color schemes shipped with Konsole transform the "normal yellow" aka ansi code 33 into a brownish-to-orangeish tone.

See e.g. the dialog box from Konsole displaying the colors from the "White on black" scheme (in french locales):

image

I'm sparing you with the other color schemes -- they are all affected.

I could alter the color scheme of my own terminal, but that wouldn't solve the problem for the other KDE users.

Now, if you take a look back to the screenshot, you'll notice that the "bright" (aka Light in tui) colors are rendered in a much more conservative way. The same with the other default Konsole color profiles.

So whatever the rationale between all this, it seems to like using the "bright" color codes instead of the "normal" ones is the way to go ; and indeed, that's exactly what the other Rust cli apps from my system are doing (Exa, Starship).

Mange commented 4 years ago

Maybe we could add configs for attributes in that case. I wouldn't want to make them bright by default.

ngirard commented 4 years ago

Well, if you allow me to rephrase, as the state of affairs is clearer on my mind. Let us forget about Konsole and its peculiarities.

When displaying light colors (yellow, green, cyan), Tydra currently uses "normal" Ansi color codes. This seems to differ from the strategy adopted by the other command-line tools I've tested, and leads in my opinion to a poorer user experience. The other tools I've tested choose to use either the "bright" escape sequences, the "bold" escape sequences, of both.

Hereafter, the screenshots are taken using Alacritty.

Here's the output of GNU ls: image

GNU ls uses bold ansi sequences by default for cyan and green.

Here is the output of Starship, a command-line prompt written in Rust: image

Starship also uses bold sequences by default.

Now for the output of Exa: image

Here, Exa uses bold and bright escape sequences for yellow and green.

By contrast, here's the output of Tydra: image

See the difference ? To me, the user experience is poorer because the colored characters don't stand out well and the colors are hard to differentiate (notably between cyan and blue in the above picture).

So I wish to rephrase the gist of this issue as: use bold or bright color sequences (or both) by default for better legibility of shortcut characters (emphasis on the default behavior).

ngirard commented 4 years ago

Here's how it looks like after modifying the source code: image

Contrast with the original code: image

ngirard commented 4 years ago

By the way, the original Hydra has its shorcuts rendered in bold and bright:

image

Mange commented 4 years ago

Fair enough. I'll make it happen! :smile:

ngirard commented 4 years ago

Hey @Mange, nice to hear from you ! Hope you're doing well. Take care !

Mange commented 4 years ago

Implementing custom text styles is pretty rough in this version of TUI, and will have to be completely redone when upgrading to the newest version of TUI.

This will have to happen after that has happened. I'll see when I get some time to work on this, but I've put it on my list.