#!/bin/bash ## EMPTY DEFAULTS ## color_bold="" color_underline="" color_standout="" color_normal="" color_black="" color_red="" color_green="" color_yellow="" color_blue="" color_magenta="" color_cyan="" color_white="" ## ONLY IF PRINTING TO A TERMINAL ## if test -t 1 && [[ -f $(which tput) ]]; then # check count of supported colors color_count=$(TERM=${TERM:-"dumb"} tput colors) if [[ ! -z "$color_count" && "$color_count" -ge 8 ]]; then color_bold="$(tput bold)" color_underline="$(tput smul)" color_standout="$(tput smso)" color_normal="$(tput sgr0)" color_black="$(tput setaf 0)" color_red="$(tput setaf 1)" color_green="$(tput setaf 2)" color_yellow="$(tput setaf 3)" color_blue="$(tput setaf 4)" color_magenta="$(tput setaf 5)" color_cyan="$(tput setaf 6)" color_white="$(tput setaf 7)" fi fi