From c3050750eadf40260664c4560225c0e1091527c2 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Wed, 26 Jun 2019 20:21:32 -0500 Subject: [PATCH] Added tBoldBox and color constants. --- towel.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/towel.sh b/towel.sh index 4cb47c1..1f9a866 100755 --- a/towel.sh +++ b/towel.sh @@ -24,6 +24,39 @@ # +# +# Color constants for tBoldBox. +# +tRED=1 +tGREEN=2 +tYELLOW=3 +tBLUE=4 +tPURPLE=5 +tCYAN=6 + + +# +# Draws bold white text inside a colored box. +# +# Parameters: +# +# COLOR - Towel color constant for box background color. +# TEXT - Text to display. +# +function tBoldBox() { + local __COLOR=$1 + local __TEXT=$2 + local __LEN=$((${#__TEXT}+6)) + local __SPACES=$(printf "%${__LEN}s") + + __COLOR=${!__COLOR} + + echo -e "\e[1m\e[4${__COLOR}m${__SPACES}\e[0m" + echo -e "\e[1m\e[4${__COLOR}m ${__TEXT} \e[0m" + echo -e "\e[1m\e[4${__COLOR}m${__SPACES}\e[0m" +} + + # # Checks to see if listed packages have been installed. # Currently DEB packages only.