(preemptive apologies if this topic has been discussed previously)
(context: iTerm 3.2.7, macOS 10.14 18A390, ncurses 6.1.20180127 via MacPorts)
I've been exploring 24bit color support, and I think there's a couple places reporting could be improved.
ncurses supports reporting 24bit color in terminfo through the ill-documented "RGB" capability since ncurses-6.0-20180121 according to the
XVilka [1] gist. I didn't find it mentioned explicitly in the release notes nor can find ncurses revision control (!?), but that version did add xterm-direct (and others) that has this capability.
$ tput -T xterm-direct RGB; echo $?
0
$
compare with:
$ tput -T xterm-256color RGB; echo $?
tput: unknown terminfo capability 'RGB'
4
$
(confusing output; I only know enough about ncurses to be dangerous, QED this topic)
As it is, the terminal software ecosystem still relies on a collection of hacks from before ncurses supported this cap to sleuth out if the terminal supports 24bit. Emacs
looks for [2] the stf24 and setb24 caps, and I don't know if
Vim can/does [3] autodetect it. Tmux does recognize the terminfo RGB cap.
Anyhow, since iTerm2 does support 24bit color with the control codes that xterm-direct supports, I think it would be useful to add that as a default selection item to "Report terminal type" profile preference drop-down, don't you think?
Now, granted, this implies existence of an xterm-direct terminfo file on the machine. As of my version of macOS, the bundled ncurses is 5.7.20081102 which doesn't include that entry. Is it viable for iTerm2 to ship an appropriate terminfo to put in a user's ~/.terminfo/ ? Unfortunately, I wasn't able to make this work in my limited testing. Either macOS's ncurses won't search ~/.terminfo/ (by itself nor when I set $TERMINFO), or it doesn't recognize the (newer?) format.
Can you think of any other ways to make usage of 24bit-color mode easier?
(postfacto apologies if I don't quite make sense. Delving into ncurses has an... effect... on one's mind)