-
Notifications
You must be signed in to change notification settings - Fork 248
/
Copy pathColor.var.sh
155 lines (138 loc) · 3.55 KB
/
Color.var.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
alias UI.Color.IsAvailable='[ $(tput colors 2>/dev/null || echo 0) -ge 16 ] && [ -t 1 ]'
if UI.Color.IsAvailable
then
UI_Color_Default=$'\033[0m'
UI_Color_Black=$'\033[0;30m'
UI_Color_Red=$'\033[0;31m'
UI_Color_Green=$'\033[0;32m'
UI_Color_Yellow=$'\033[0;33m'
UI_Color_Blue=$'\033[0;34m'
UI_Color_Magenta=$'\033[0;35m'
UI_Color_Cyan=$'\033[0;36m'
UI_Color_LightGray=$'\033[0;37m'
UI_Color_DarkGray=$'\033[0;90m'
UI_Color_LightRed=$'\033[0;91m'
UI_Color_LightGreen=$'\033[0;92m'
UI_Color_LightYellow=$'\033[0;93m'
UI_Color_LightBlue=$'\033[0;94m'
UI_Color_LightMagenta=$'\033[0;95m'
UI_Color_LightCyan=$'\033[0;96m'
UI_Color_White=$'\033[0;97m'
# flags
UI_Color_Bold=$'\033[1m'
UI_Color_Dim=$'\033[2m'
UI_Color_Italics=$'\033[3m'
UI_Color_Underline=$'\033[4m'
UI_Color_Blink=$'\033[5m'
UI_Color_Invert=$'\033[7m'
UI_Color_Invisible=$'\033[8m'
UI_Color_NoBold=$'\033[21m'
UI_Color_NoDim=$'\033[22m'
UI_Color_NoItalics=$'\033[23m'
UI_Color_NoUnderline=$'\033[24m'
UI_Color_NoBlink=$'\033[25m'
UI_Color_NoInvert=$'\033[27m'
UI_Color_NoInvisible=$'\033[28m'
else
UI_Color_Default=""
UI_Color_Black=""
UI_Color_Red=""
UI_Color_Green=""
UI_Color_Yellow=""
UI_Color_Blue=""
UI_Color_Magenta=""
UI_Color_Cyan=""
UI_Color_LightGray=""
UI_Color_DarkGray=""
UI_Color_LightRed=""
UI_Color_LightGreen=""
UI_Color_LightYellow=""
UI_Color_LightBlue=""
UI_Color_LightMagenta=""
UI_Color_LightCyan=""
UI_Color_White=""
# flags
UI_Color_Bold=""
UI_Color_Dim=""
UI_Color_Italics=""
UI_Color_Underline=""
UI_Color_Blink=""
UI_Color_Invert=""
UI_Color_Invisible=""
UI_Color_NoBold=""
UI_Color_NoDim=""
UI_Color_NoItalics=""
UI_Color_NoUnderline=""
UI_Color_NoBlink=""
UI_Color_NoInvert=""
UI_Color_NoInvisible=""
fi
alias UI.Powerline.IsAvailable="UI.Color.IsAvailable && test -z \${NO_UNICODE-} && (echo -e $'\u1F3B7' | grep -v F3B7) &> /dev/null"
if UI.Powerline.IsAvailable
then
UI_Powerline_PointingArrow=$'\u27a1'
UI_Powerline_ArrowLeft=$'\ue0b2'
UI_Powerline_ArrowRight=$'\ue0b0'
UI_Powerline_ArrowRightDown=$'\u2198'
UI_Powerline_ArrowDown=$'\u2B07'
UI_Powerline_PlusMinus=$'\ue00b1'
UI_Powerline_Branch=$'\ue0a0'
UI_Powerline_RefersTo=$'\u27a6'
UI_Powerline_OK=$'\u2714'
UI_Powerline_Fail=$'\u2718'
UI_Powerline_Lightning=$'\u26a1'
UI_Powerline_Cog=$'\u2699'
UI_Powerline_Heart=$'\u2764'
# colorful
UI_Powerline_Star=$'\u2b50'
UI_Powerline_Saxophone=$'\U1F3B7'
UI_Powerline_ThumbsUp=$'\U1F44D'
else
UI_Powerline_PointingArrow="'~'"
UI_Powerline_ArrowLeft="'<'"
UI_Powerline_ArrowRight="'>'"
UI_Powerline_ArrowRightDown="'>'"
UI_Powerline_ArrowDown="'_'"
UI_Powerline_PlusMinus="'+-'"
UI_Powerline_Branch="'|}'"
UI_Powerline_RefersTo="'*'"
UI_Powerline_OK="'+'"
UI_Powerline_Fail="'x'"
UI_Powerline_Lightning="'!'"
UI_Powerline_Cog="'{*}'"
UI_Powerline_Heart="'<3'"
# colorful
UI_Powerline_Star="'*''"
UI_Powerline_Saxophone="'(YEAH)'"
UI_Powerline_ThumbsUp="'(OK)'"
fi
UI.Color.Print() {
local -i colorCode="$1"
if UI.Color.IsAvailable
then
local colorString="\$'\033[${colorCode}m'"
eval echo "${colorString}"
else
echo
fi
}
UI.Color.256text() {
local -i colorNumber="$1"
if UI.Color.IsAvailable
then
local colorString="\$'\033[38;5;${colorNumber}m'"
eval echo "${colorString}"
else
echo
fi
}
UI.Color.256background() {
local -i colorNumber="$1"
if UI.Color.IsAvailable
then
local colorString="\$'\033[48;5;${colorNumber}m'"
eval echo "${colorString}"
else
echo
fi
}