That also leads to problem 12: Certain popular terminals that default to setting TERM=xterm256-color while not being xterm-compatible.
Edit: I just came across `xtermcontrol`, which can abstract the background check in scripts, and is in all the major package managers.
It's probably too late for terminals to add a concept of semantic color, other than "default foreground" and "default background", but the situation as it is forces TUI authors to either stick to the basic eight or make colors completely user-configurable, if they don't want to leave anybody out.
By semantic color I mean what editors do, where the presentation is separated from the intention. Unclear how to even start with that for terminals though.
(To someone out there about to tell me about how I can custom theme HN: please consider that I might spend too much time here already and don't need it to be easy to use in the dark. Cheers)
These days I just gave up and manually configure most apps to use ANSI colors (e.g. fzf etc have command switches for that), and let Vim and Emacs be the only non-ANSI apps which are instead set to match the colorscheme I use in the rest of the terminal. (Although stuff like vim-dim let’s you go one step further if you want.)