I am trying to print a text in the terminal using echo command.
I want to print the text in a red color. How can I do that?
I've written swag to achieve just that.
You can just do
pip install swag
Now you can install all the escape commands as txt files to a given destination via:
swag install -d
Or even easier via:
swag install
Which will install the colors to ~/.colors
.
Either you use them like this:
echo $(cat ~/.colors/blue.txt) This will be blue
Or this way, which I find actually more interesting:
swag print -c red -t underline "I will turn red and be underlined"
Check it out on asciinema!