/
colours.theme.sh
271 lines (217 loc) · 4.62 KB
/
colours.theme.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
#!/usr/bin/env bash
function __ {
echo "$@"
}
function __make_ansi {
next=$1; shift
echo "\[\e[$(__$next $@)m\]"
}
function __make_echo {
next=$1; shift
echo "\033[$(__$next $@)m"
}
function __reset {
next=$1; shift
out="$(__$next $@)"
echo "0${out:+;${out}}"
}
function __bold {
next=$1; shift
out="$(__$next $@)"
echo "${out:+${out};}1"
}
function __faint {
next=$1; shift
out="$(__$next $@)"
echo "${out:+${out};}2"
}
function __italic {
next=$1; shift
out="$(__$next $@)"
echo "${out:+${out};}3"
}
function __underline {
next=$1; shift
out="$(__$next $@)"
echo "${out:+${out};}4"
}
function __negative {
next=$1; shift
out="$(__$next $@)"
echo "${out:+${out};}7"
}
function __crossed {
next=$1; shift
out="$(__$next $@)"
echo "${out:+${out};}8"
}
function __color_normal_fg {
echo "3$1"
}
function __color_normal_bg {
echo "4$1"
}
function __color_bright_fg {
echo "9$1"
}
function __color_bright_bg {
echo "10$1"
}
function __color_black {
echo "0"
}
function __color_red {
echo "1"
}
function __color_green {
echo "2"
}
function __color_yellow {
echo "3"
}
function __color_blue {
echo "4"
}
function __color_magenta {
echo "5"
}
function __color_cyan {
echo "6"
}
function __color_white {
echo "7"
}
function __color_rgb {
r=$1 && g=$2 && b=$3
[[ r == g && g == b ]] && echo $(( $r / 11 + 232 )) && return # gray range above 232
echo "8;5;$(( ($r * 36 + $b * 6 + $g) / 51 + 16 ))"
}
function __color {
color=$1; shift
case "$1" in
fg|bg) side="$1"; shift ;;
*) side=fg;;
esac
case "$1" in
normal|bright) mode="$1"; shift;;
*) mode=normal;;
esac
[[ $color == "rgb" ]] && rgb="$1 $2 $3"; shift 3
next=$1; shift
out="$(__$next $@)"
echo "$(__color_${mode}_${side} $(__color_${color} $rgb))${out:+;${out}}"
}
function __black {
echo "$(__color black $@)"
}
function __red {
echo "$(__color red $@)"
}
function __green {
echo "$(__color green $@)"
}
function __yellow {
echo "$(__color yellow $@)"
}
function __blue {
echo "$(__color blue $@)"
}
function __magenta {
echo "$(__color magenta $@)"
}
function __cyan {
echo "$(__color cyan $@)"
}
function __white {
echo "$(__color white $@)"
}
function __rgb {
echo "$(__color rgb $@)"
}
function __color_parse {
next=$1; shift
echo "$(__$next $@)"
}
function color {
echo "$(__color_parse make_ansi $@)"
}
function echo_color {
echo "$(__color_parse make_echo $@)"
}
black="\[\e[0;30m\]"
red="\[\e[0;31m\]"
green="\[\e[0;32m\]"
yellow="\[\e[0;33m\]"
blue="\[\e[0;34m\]"
purple="\[\e[0;35m\]"
cyan="\[\e[0;36m\]"
white="\[\e[0;37m\]"
orange="\[\e[0;91m\]"
bold_black="\[\e[30;1m\]"
bold_red="\[\e[31;1m\]"
bold_green="\[\e[32;1m\]"
bold_yellow="\[\e[33;1m\]"
bold_blue="\[\e[34;1m\]"
bold_purple="\[\e[35;1m\]"
bold_cyan="\[\e[36;1m\]"
bold_white="\[\e[37;1m\]"
bold_orange="\[\e[91;1m\]"
underline_black="\[\e[30;4m\]"
underline_red="\[\e[31;4m\]"
underline_green="\[\e[32;4m\]"
underline_yellow="\[\e[33;4m\]"
underline_blue="\[\e[34;4m\]"
underline_purple="\[\e[35;4m\]"
underline_cyan="\[\e[36;4m\]"
underline_white="\[\e[37;4m\]"
underline_orange="\[\e[91;4m\]"
background_black="\[\e[40m\]"
background_red="\[\e[41m\]"
background_green="\[\e[42m\]"
background_yellow="\[\e[43m\]"
background_blue="\[\e[44m\]"
background_purple="\[\e[45m\]"
background_cyan="\[\e[46m\]"
background_white="\[\e[47;1m\]"
background_orange="\[\e[101m\]"
normal="\[\e[0m\]"
reset_color="\[\e[39m\]"
# These colors are meant to be used with `echo -e`
echo_black="\033[0;30m"
echo_red="\033[0;31m"
echo_green="\033[0;32m"
echo_yellow="\033[0;33m"
echo_blue="\033[0;34m"
echo_purple="\033[0;35m"
echo_cyan="\033[0;36m"
echo_white="\033[0;37;1m"
echo_orange="\033[0;91m"
echo_bold_black="\033[30;1m"
echo_bold_red="\033[31;1m"
echo_bold_green="\033[32;1m"
echo_bold_yellow="\033[33;1m"
echo_bold_blue="\033[34;1m"
echo_bold_purple="\033[35;1m"
echo_bold_cyan="\033[36;1m"
echo_bold_white="\033[37;1m"
echo_bold_orange="\033[91;1m"
echo_underline_black="\033[30;4m"
echo_underline_red="\033[31;4m"
echo_underline_green="\033[32;4m"
echo_underline_yellow="\033[33;4m"
echo_underline_blue="\033[34;4m"
echo_underline_purple="\033[35;4m"
echo_underline_cyan="\033[36;4m"
echo_underline_white="\033[37;4m"
echo_underline_orange="\033[91;4m"
echo_background_black="\033[40m"
echo_background_red="\033[41m"
echo_background_green="\033[42m"
echo_background_yellow="\033[43m"
echo_background_blue="\033[44m"
echo_background_purple="\033[45m"
echo_background_cyan="\033[46m"
echo_background_white="\033[47;1m"
echo_background_orange="\033[101m"
echo_normal="\033[0m"
echo_reset_color="\033[39m"