This question already has an answer here:
- Pipable command to print in color? 4 answers
I want to write a bash script that prints some information to the terminal STDOUT. For better readability and structure, I would like to color the different items and highlight them this way.
Now, is there a Bash equivalent to the Windows-CMD/DOS command
COLOR which sets the currently used background and font color? And how do I reset the color back to the terminal default after finishing my script?
I have read Pipable command to print in color?, but only some answers are written in Bash so that they can be easily included in my script. Besides this, the answers there lack the following points I want:
- change background color
- display white foreground color, the default color set in
gnome-terminalgets displayed instead (which is neon green for me)
- make all available colors accessible somehow, not only a small subset by keywords. I could imagine e.g. some kind of RGB encoding to pass as function argument for easily specifying a color.