Hacker News new | ask | show | jobs
by scrollaway 2938 days ago
The tools don't exactly choose the color. They choose a color name from a palette. Your terminal's theme defines that palette.

If your terminal has a background very close to one of the colors on that palette, that is a theme problem, not an app problem.

2 comments

This was a long time ago before terminal emulators had themes and I also did a lot of work on actual terminals (monochrome hardware) and the console (black background with gray text). Even my current emulator doesn't support "themes". I have to set each color register individually in the .Xresources file. On modern hardware this works fine, but years ago the quality of CRTs was such that you couldn't guarantee brightness and color levels across devices.

Do you remember the days of X Modelines? I still have the nightmares.

That's mostly true, but there are several different methods for sending colours via escape codes and the one you discuss is just the ANSI standard. There is also 265 colour palette and even true colours (defined via RGB values). However most tools will use the standard 8 colour palette or the extended 8x3 colour palette (8 colours across 3 different intensities) because they're supported on pretty much every terminal emulator (even on Windows's cmd.exe).

So it is possible for tools to choose colours by an exact RGB value, but typically they wont.

The other thing to remember is some tools can have their colours remapped. Even tools people might not expect to be able to. eg you can configure (via environmental variables IIRC) `ls` to have specific colours for specific inode types. However in my personal opinion it is a lot of faff for very little reward.