Add 'colors.sh'
parent
3a953927b6
commit
dedec42d47
@ -0,0 +1,20 @@
|
|||||||
|
verbose () {
|
||||||
|
echo $2 "${color_green}$1${color_normal}"
|
||||||
|
}
|
||||||
|
error () {
|
||||||
|
echo $2 "${color_red}$1${color_normal}"
|
||||||
|
}
|
||||||
|
warning () {
|
||||||
|
echo $2 "${color_yellow}$1${color_normal}"
|
||||||
|
}
|
||||||
|
# check for color support
|
||||||
|
if test -t 1; then
|
||||||
|
# see if it supports colors...
|
||||||
|
ncolors=$(tput colors)
|
||||||
|
if test -n "$ncolors" && test $ncolors -ge 8; then
|
||||||
|
color_normal="$(tput sgr0)"
|
||||||
|
color_red="$(tput setaf 1)"
|
||||||
|
color_green="$(tput setaf 2)"
|
||||||
|
color_yellow="$(tput setaf 3)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
Loading…
Reference in New Issue