-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpp.sh
45 lines (41 loc) · 795 Bytes
/
pp.sh
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
37
38
39
40
41
42
43
44
45
#!/bin/bash
PP_CURRENT_FGCOLOR="normal"
PP_CURRENT_BGCOLOR="normal"
function fgcolor {
if [ $# -eq 0 ]; then
echo $PP_CURRENT_FGCOLOR
elif [ "$1" == "normal" ]; then
echo -ne "\e[0m"
PP_CURRENT_FGCOLOR="normal"
else
PP_CURRENT_FGCOLOR=$1
local black='0'
local red='1'
local green='2'
local yellow='3'
local blue='4'
local magenta='5'
local cyan='6'
local white='7'
eval "tput setaf \${$1}"
fi
}
function bgcolor {
if [ $# -eq 0 ]; then
echo $PP_CURRENT_BGCOLOR
else
PP_CURRENT_BGCOLOR=$1
local black='0'
local red='1'
local green='2'
local yellow='3'
local blue='4'
local magenta='5'
local cyan='6'
local white='7'
eval "tput setab \${$1}"
fi
}
function resetcolor {
tput sgr0
}