diff --git a/extract_utils.sh b/extract_utils.sh index ce3f0bd..3ccf854 100644 --- a/extract_utils.sh +++ b/extract_utils.sh @@ -1783,3 +1783,24 @@ function generate_prop_list_from_image() { # Clean-up rm -f "$output_list_tmp" } + +function colored_echo() { + IFS=" " + local color=$1; + shift + if ! [[ $color =~ '^[0-9]$' ]] ; then + case $(echo $color | tr '[:upper:]' '[:lower:]') in + black) color=0 ;; + red) color=1 ;; + green) color=2 ;; + yellow) color=3 ;; + blue) color=4 ;; + magenta) color=5 ;; + cyan) color=6 ;; + white|*) color=7 ;; # white or invalid color + esac + fi + tput setaf $color + printf '%s\n' "$*" + tput sgr0 +}