Formatted Text in the Command Line
==================================
Let us look at the following text line:
"[31mHellow, world![0m"
I don't know yet if you can see the text in red. If you cannot see it, you can
download this text file.
Let us look at another example:
"[31;5mHello, world![0m"
Now, at least in my terminal, the text is also blinking.
You can make the your system display formatted texts and change its position on
the screen using commands that print plain text using the ANSI Escape Sequences.
In the example above, I used "<Esc>[<colon-separated-arguments>m". The order
does not matter. For example:
"<Esc>[31;5mHello, word!<Esc[0m"
prints "Hello, world!" in red and blinking.
30-37 are used for text foreground color.
40-47 are used for background colors.
5 means blinking.
o resets formattings.
To see more, visit:
https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
Now, how to add the escape sequence?
------------------------------------
In Unix/Linux shells and vi: click <ctrl>+V<Esc> and the sequence+text.
In a print command: use "\033" to print the Escape characters. \033 means
an octal representation of the decimal number 51 (or 0x1B).
For example, the "echo" command:
echo -e "\033[35;5mHello, world\!\033[0m"
prints "Hello, world!" in blinking magenta.