Comment 5 for bug 1752352

Egmont Koblinger (egmont-gmail) wrote :

Using the color 30 or 37 (black or white foreground) without setting the background, or similarly, 40 or 47 (black or white background) without setting the foreground is a pretty bad idea, since, without knowing the terminal's color scheme (which is often white on black, or black on white), it might easily result in unreadable text.

I don't see why links would be underlined, so I assume that 4 is also a bug.

One possible explanation would be that it wanted to be 40 instead (white text on black background), it's at least readable, although potentially ugly, still doesn't explain that 5, and also the order of the three numbers is really weird then.

My best guess is that that 4 is meant to be 48 (or even better, 38), to use extended colors. In that case 5 is an additional parameter to that (that is, no blinking), and 37 is yet another additional parameter (the color index from the 256-color palette), resulting in a cyan-ish color.

This guess is also supported by the presence of "DIR 38;5;5" and "EXEC 38;5;202" in the file, which mean to use color index 5 (magenta) or 202 (bright red) for the foreground.

Note, however, that the use of such extended colors is also buggy, since they are under TERM declarations that don't claim to support 256 colors. "38;5;xx" and "48;5;xx" should only be allowed under sections of "TERM whatever-256color".

"DIR 38;5;5" could simply be replaced by "DIR 35", it's the same color, but terminals that don't support 256 colors cannot be expected to understand the long format. For "EXEC 38;5;202" the best (simplest) is probably to find a color from the legacy 8-color palette. Or reorganize the entire file so that terminals with 256-color support have different values.