I am trying to make my shell script supporting as much terminals as possible, that is, adding ANSI colors, bold and dim only when supported. However, I want to detect the number of colors supported. We can use tput colors.
However, I find that some systems that are stripped down to minimal does not have it installed. So, I want to implement it in shell.
Similar to getting bold and dim support, we can:
infocmp | grep -q bold # bold support? infocmp | grep -q dim # dim support? How does tput colors work? Any equivalent of tput colors with infocmpPOSIX commands? Please help and answer.