There is a color codes script on GitHub suitable for sourcing, which I am modifying for my own purposes.
Background
I have an odd mix of environments to work in, from a Mac OS terminal, to various Linux distributions, and even to a MobaXterm on my Windows work laptop. I'd like to get the color codes to a maximum portability for these environments
In MobaXterm, tput setaf 2 (for example) doesn't work at all—it just says "Segmentation fault," though I see no ill effects. Likewise, echo '\e[4;32m' doesn't work either; it just displays those literal characters. (This is likely because it is BusyBox echo.)
printf '\e[4;32m' works, though.
The question:
Is there any reason not to use printf in place of tput in all cases?
Or put another way:
Is there any environment (or OS or shell) in which printf WON'T work to set terminal colors, but tput WILL?