Skip to main content
deleted 139 characters in body
Source Link
sudoer
  • 65
  • 1
  • 6

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.

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 infocmp? Please help and answer.

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.

How does tput colors work? Any equivalent of tput colors with POSIX commands? Please help and answer.

Source Link
sudoer
  • 65
  • 1
  • 6

How does `tput` detect color support

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 infocmp? Please help and answer.