## Colourful Consoles with Bash

Posted August 14, 2017. 228 words.

With bash it is trivially easy to produce nice, colourful console output with the code below. Simply paste it into the top of your script, and then you can colour your text by just printing the variables.

For example, if you want bold yellow text with a red background use echo "${BOLD}${YELLOW}${BRED}Critical Warning!${CLEAR}". Additionally, you can ${ITALIC}, ${UNDERLINE}, ${INVERT}, or ${STRIKE} text as you see fit. Once you are done with formatted text, use ${CLEAR} to clear all formatting. Lastly, ${RESET} and \${RULE} to reset the screen and create a horizontal rule. Vertical rules are left as an exercise for the reader.