-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.colors
36 lines (33 loc) · 1.42 KB
/
.colors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# vim: set ft=bash noet:
#ANSI color codes
if tty -s
then
set -o | \grep -wq xtrace.*on && trace=1 || trace=0
if type -P tput >/dev/null 2>&1;then
export normal=$(tput sgr0)
export bell=$(tput bel)
export bold=$(tput bold)
export dim=$(tput dim)
export italics=$(tput sitm)
export underlined=$(tput smul)
export blink=$(tput blink)
set +x
export reverse=$(tput rev)
export hidden=$(tput invis)
[ $trace = 1 ] && set -x
if [ $BASH_VERSINFO -ge 4 ];then
export escapeChar=$'\e'
export blinkOff=${escapeChar}'[25m'
declare -A effects=( [bold]=$(tput bold) [dim]=$(tput dim) [italics]=$(tput sitm) [underlined]=$(tput smul) [blink]=$(tput blink) [reverse]=$(tput rev) [hidden]=$(tput invis) [blinkOff]=$blinkOff )
declare -A colors=( [red]=$(tput setaf 1) [green]=$(tput setaf 2) [blue]=$(tput setaf 4) [cyan]=$(tput setaf 6) [yellow]=$(tput setaf 11) [yellowOnRed]=$(tput setaf 11 setab 1) [greenOnBlue]=$(tput setaf 2 setab 4) [yellowOnBlue]=$(tput setaf 11 setab 4) [cyanOnBlue]=$(tput setaf 6 setab 4) [whiteOnBlue]=$(tput setaf 7 setab 4) [redOnGrey]=$(tput setaf 1 setab 7) [blueOnGrey]=$(tput setaf 4 setab 7) )
else
export escapeChar=$'\033'
fi
else
echo "=> You must install the tput utility if you want the bash prompt colors." >&2
[ $BASH_VERSINFO -ge 4 ] && export escapeChar=$'\e' || export escapeChar=$'\033'
export normal=${escapeChar}'[m'
fi
# export colors effects
printf $normal
fi