I am writing a bash script. I would like to print a colored string to the terminal via the echo
command and have the color of the string change based on the background color of the terminal.
I currently am just printing the string in white like so: echo -e "$(tput setaf 7)my string here"
.
Is there a way to print the string in a different color if the terminal background color is also white? I would prefer not to set the background color myself to ensure that my string is visible.
Thanks in advance!