Colourful Consoles with Bash Aug. 14, 2017 in Bash, Text, Tutorial
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.
Visiting ParisCats in the Grass