I want to change the text colour in a shell. I can use tput to get the correct escape codes. For example,
echo "$(tput setaf 5)My text$(tput sgr0)"
outputs My text in a pink-ish tone.
This works fine on Linux, macOS, FreeBSD, NetBSD, and Solaris. On OpenBSD 7.2, however, I get the following error:
tput: not enough arguments (3) for capability `setaf'
According to the OpenBSD docs of tput, the attribute should be defined in terminfo or termcap. I don't see setaf defined in the docs for termcap, so I assume tput interprets setaf as defined in the docs for terminfo. According to those docs:
To change the current foreground or background color on a Tektronix-type terminal, use setaf (set ANSI foreground) and setab (set ANSI background) or setf (set foreground) and setb (set background). These take one parameter, the color number.
This conflicts what I've been told by the error message. On the other hand, I can use tput setaf 5 0 0 and, regardless of the last two parameters, the foreground colour is changed to pink-ish.
Why does tput require three parameters on OpenBSD, and what do those extra two parameters mean?