Use proper ANSI code "39" for default color
The method of querying "isDarkTerminal()" via the environment variable
COLORFGBG is broken and not supported by all terminals, leading to unreadable text.
I suggest to remove it entirely.
If you really need to know if the terminal has a dark or light background,
a more reliable way would probably be via the "OSC 4/10/11" escape codes.
See eg.
- https://bugzilla.gnome.org/show_bug.cgi?id=733423
- https://www.xfree86.org/current/ctlseqs.html
- https://github.com/JessThrysoee/xtermcontrol/blob/master/doc/ctlseqs.txt#L745
The ANSI color code "39" denotes the default foreground color in any properly configured terminal, and should always be readable on the default background, both for light- and dark-background terminals. (i.e. it should automatically be black for light- and white/grey for a black BG terminal).
It has the same effect as code "0" (normal/reset), but without resetting other text attributes (like bold or underlined).