144
|
1 #!/bin/sh
|
|
2
|
|
3 _c() {
|
|
4 color_name="${1}"
|
|
5 shift
|
|
6 text="${*}"
|
|
7 esq="\033["
|
|
8 r="${esq}0m" # r for reset
|
|
9 case "${color_name}" in
|
|
10 bold_*) color="1;";;
|
|
11 *) color="0;";;
|
|
12 esac
|
|
13 case "${color_name}" in
|
|
14 *black) color="${color}30";;
|
|
15 *blue) color="${color}34";;
|
|
16 *green) color="${color}32";;
|
|
17 *cyan) color="${color}36";;
|
|
18 *red) color="${color}31";;
|
|
19 *purple) color="${color}35";;
|
|
20 *brown) color="${color}33";;
|
|
21 *gray) color="${color}37";;
|
|
22 esac
|
|
23 color="${esq}${color}m"
|
|
24 printf "${color}%s${r}" "${text}"
|
|
25 }
|
|
26
|