forked from Wizcorp/libbash
-
Notifications
You must be signed in to change notification settings - Fork 1
/
colorize.sh
73 lines (58 loc) · 1.14 KB
/
colorize.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
declare -a bold=("\033[1m" "\033[22m");
declare -a italic=("\033[3m" "\033[23m");
declare -a underline=("\033[4m" "\033[24m");
declare -a inverse=("\033[7m" "\033[27m");
declare -a white=("\033[37m" "\033[39m");
declare -a grey=("\033[90m" "\033[39m");
declare -a black=("\033[30m" "\033[39m");
declare -a blue=("\033[34m" "\033[39m");
declare -a cyan=("\033[36m" "\033[39m");
declare -a green=("\033[32m" "\033[39m");
declare -a magenta=("\033[35m" "\033[39m");
declare -a red=("\033[31m" "\033[39m");
declare -a yellow=("\033[33m" "\033[39m");
cWrap(){
echo -en "$(eval "echo \${${1:-}[0]}")"
cat -;
echo -en "$(eval "echo \${${1:-}[1]}")"
}
black(){
cat - | cWrap black;
}
red(){
cat - | cWrap red;
}
green(){
cat - | cWrap green;
}
yellow(){
cat - | cWrap yellow;
}
blue(){
cat - | cWrap blue;
}
magenta(){
cat - | cWrap magenta;
}
cyan(){
cat - | cWrap cyan;
}
white(){
cat - | cWrap white;
}
grey(){
cat - | cWrap grey;
}
bold(){
cat - | cWrap bold;
}
italic(){
cat - | cWrap italic;
}
underline(){
cat - | cWrap underline;
}
inverse(){
cat - | cWrap inverse;
}