ANSI colours aren't consistent across X terminal programs

March 7, 2023

There is a long standing set of 'ANSI colour codes' in terminal emulators, including terminal programs for X. Here is a table of them, and fidian/ansi will provide you with a convenient Bash script that will show you what these colors look like in your terminal program. The latter is potentially relevant because, shockingly, no two X terminal programs I've tried render these ANSI colours exactly the same (between xterm, urxvt, Gnome Terminal, and konsole; xfce4-terminal may render the same as Gnome Terminal in some quick tests).

I've traditionally been very against using colours in my terminals, because in my normal black on white choice, the colours programs chose often wind up looking like an angry fruit salad explosion. Given how glaringly annoying colours looked to me, I didn't really understand why other people liked them until, a few years ago, I noticed that the same colours in Gnome Terminal looked rather different and generally came across as less of an assault on my eyes. Using fidian/ansi and its --color-table option shows that I wasn't just imagining this; in side by side comparisons, Gnome Terminal seems to clearly shift colours (in a black on white setup) to less intense and more readable.

Beyond the colour shifts in Gnome Terminal, there are other interesting colour changes from what you might expect. For instance, in all terminal emulators, the result of rendering 'normal' white coloured text in a black on white terminal is not invisible white text, but a greyish colour that remains somewhat readable. There are also 'faint' versions of basic ANSI colours, and the interpretation of faint white text on a white background isn't necessarily what you'd expect and varies quite a bit between terminal programs (with urxvt seeming to ignore the faintness entirely for all colours).

With enough work I could probably find out what specific colours Gnome Terminal is using and adjust my xterm to use them, so I have less annoying colours on the rare occasions when I might need them. As a practical matter, I'm not that interested in having colours in my terminals; even most of Gnome Terminal's colours aren't all that appealing.

I'd like to put this forward as a reason for people to entirely avoid using colours in terminal programs and terminal environments, but I know that ship has sailed years ago. Apparently other people have found or set up colour sets in their terminals that they like and find a lot more readable than I do with any setup that I've seen.

Written on 07 March 2023.
« Special tcpdump filtering options for OpenBSD's pflog interface
Debconf's questions, or really whiptail, doesn't always work in xterms »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue Mar 7 21:33:42 2023
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.