-
Notifications
You must be signed in to change notification settings - Fork 0
/
themecord
executable file
·306 lines (262 loc) · 8.17 KB
/
themecord
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
#!/usr/bin/env sh
#This is generated by themecord builder!
themecordFiller=$(cat << 'EOF'
--list-item-transition: 0.2s ease; /* channels/members/settings hover transition */
--icon-spin-transition: 1s ease; /* round icon button spin (settings, emoji, etc.) */
}
.theme-dark {
--background-primary: var(--color2);
--background-primary-alt: var(--color3);
--background-secondary: var(--color1);
--background-secondary-alt: var(--color2);
--background-floating: var(--color5);
--background-accent-gradient: var(--color2);
--background-tertiary: var(--color0);
--background-mentioned: var(--color12);
--background-mentioned-hover: var(--color3);
--background-modifier-hover: var(--color3);
--background-modifier-active: var(--color12);
--background-modifier-accent: var(--color3);
--background-modifier-selected: var(--color13);
--scrollbar-auto-thumb: var(--color0);
--scrollbar-auto-thumb-hover: var(--color2);
--scrollbar-thin-track: transparent;
--scrollbar-auto-track: var(--color5);
--scrollbar-auto-scrollbar-color-thumb: var(--color5);
--scrollbar-auto-scrollbar-color-track: var(--color12);
--text-link: var(--color0);
--text-muted: var(--color15);
--text-normal: var(--color15);
--text-positive: var(--color15);
--interactive-muted: var(--color15);
--interactive-active: var(--color15);
--interactive-normal: var(--color15);
--interactive-selected: var(--color15);
--header-primary: var(--color15);
--channels-default: var(--color15);
--header-secondary: var(--color15);
--channeltextarea-background: var(--color14);
}
.theme-light {
--background-primary: var(--color13);
--background-primary-alt: var(--color12);
--background-secondary: var(--color14);
--background-secondary-alt: var(--color13);
--background-tertiary: var(--color4);
--background-floating: var(--color10);
--background-accent-gradient: var(--color6);
--background-modifier-accent: var(--color9);
--background-modifier-hover: var(--color15);
--background-modifier-active: var(--color14);
--background-modifier-selected: var(--color13);
--background-mentioned: var(--color10);
--background-mentioned-hover: var(--color10);
--scrollbar-thin-track: transparent;
--scrollbar-auto-track: var(--color13);
--scrollbar-auto-thumb: var(--color13);
--scrollbar-auto-thumb-hover: var(--color7);
--scrollbar-auto-scrollbar-color-track: var(--color8);
--scrollbar-auto-scrollbar-color-thumb: var(--color10);
--text-link: var(--color0);
--text-muted: var(--color1);
--text-normal: var(--color1);
--text-positive: var(--color0);
--interactive-muted: var(--color1);
--interactive-active: var(--color1);
--interactive-normal: var(--color1);
--interactive-selected: var(--color1);
--header-primary: var(--color10);
--header-secondary: var(--color10);
--channels-default: var(--color10);
--channeltextarea-background: var(--color14);
}
/* Animations */
@keyframes popup {
0% {
transform: scale(1) translateY(0);
}
50% {
transform: scale(1.05) translateZ(-1px);
}
100% {
transform: scale(1) translateY(0);
}
}
button:hover,
button:focus,
a:hover,
a:focus,
input:hover,
input:focus,
select:hover,
select:focus,
textarea:hover,
textarea:focus,
[role="button"]:hover,
[role="button"]:focus,
[role="link"]:hover,
[role="link"]:focus,
.button-38aScr:hover,
.button-38aScr:focus,
.form_a7d72e:hover,
.form_a7d72e:focus,
[class*="clickable"]:hover,
[class*="clickable"]:focus,
[class*="wrapper"]:hover,
[class*="wrapper"]:focus {
animation: popup 0.3s ease-in-out;
border-radius: 20px;
}
/* Thanks https://github.com/refact0r for this piece of code */
:root.reduce-motion {
--list-item-transition: none;
--icon-spin-transition: none;
}
.wrapper_d8bfb3 .link_d8bfb3 /* channels */,
.container_e9f61e /* members */,
.channel_c91bad /* dms */,
.side_a0 .item_a0 /* settings */ {
transition: margin-left var(--list-item-transition);
}
.wrapper_d8bfb3:hover .link_d8bfb3,
.side_a0 .item_a0:hover {
margin-left: 10px;
}
.container_e9f61e:hover,
.channel_c91bad:hover {
margin-left: 18px;
}
/* spin hover animations */
button.button_f67531 /* make user panel buttons round */ {
border-radius: 50%;
}
.attachButton_f298d4 .attachButtonInner_f298d4 /* upload button */,
.emojiButton_d0696b .contents_dd4f85 /* emoji button */,
.closeButton_df5532 /* settings exit button */,
.contents_dd4f85 > .closeIcon_f9a4c9 /* modal close */ {
transition: transform var(--icon-spin-transition);
}
.button_f67531:last-child:hover .contents_dd4f85,
.attachButton_f298d4:hover .attachButtonInner_f298d4,
.emojiButton_d0696b:hover .contents_dd4f85,
.closeButton_df5532:hover,
.contents_dd4f85:hover > .closeIcon_f9a4c9 {
transform: rotate(360deg);
}
EOF
)
themecordBase=$(cat << 'EOF'
/**
* @name Themecord
* @author danihek
* @version 1.0.8
* @description Discord theme compatible with your wallpaper!
* @authorId 518107210803576852
* @source https://github.com/danihek/Themecord
*/
EOF
)
#!/usr/bin/env sh
# RUN THIS SCRIPT RIGHT AFTER ONE OF THE FOLLOWING:
# - hellwal
# - pywal
# - wallust
#
# TO PROPERLY APPLY COLORS!
confPath="/home/$USER/.config"
supportedClients=("Vencord" "vesktop")
availableClients=()
generatedColors="hellwal" # default option is hellwal
colosPath=""
show_help() {
echo "Usage: themecord [OPTION]"
echo "Discord theme will always match your wallpaper! "
echo
echo "Options:"
echo " -h Display this message and exit"
echo
echo "Select wallpaper palette backend:"
echo " -g Use hellwal"
echo " -p Use pywal"
echo " -w Use wallust"
echo
echo " -f Provide path to generated discord colors"
echo
}
while getopts ":hwpgf:" opt; do
case ${opt} in
h )
show_help
exit 0
;;
w )
generatedColors="wallust"
;;
p )
generatedColors="wal"
;;
g )
generatedColors="hellwal"
colorsPath="$OPTARG"
;;
f )
colorsPath="$OPTARG"
;;
\? )
echo "Invalid option: -$OPTARG" 1>&2
echo
show_help
exit 1
;;
esac
done
function print_err() {
echo "[ERROR] $1"
echo "Exitting..."
}
for client in "${supportedClients[@]}"; do
client_path=~/.config/$client
if test -d $(realpath "$client_path"); then
echo "[SUCCESS] $client DETECTED (path: $client_path)"
availableClients+=("$client")
continue
else
echo "[FAILURE] $client not DETECTED (path: $client_path)"
continue
fi
done
if [ -z "$availableClients" ]; then
print_err "No compatible clients detected! In order to use this script you have to use compatible discord clients! Check out github page for more info: https://github.com/danihek/Themecord"
exit
fi
for client in "${availableClients[@]}"; do
themecordPath="/home/$USER/.config/$client/themes/Themecord.css"
if test -f "$themecordPath"; then
echo "[INFO] Themecord found in $client"
else
echo :root { > $themecordPath
echo "}" >> $themecordPath
printf '%s\n' "$themecordBase" >> $themecordPath
echo "[INFO] Added themecord base to: $themecordPath"
fi
done
if [ "$colorsPath" == "" ]; then
colorsPath="/home/$USER/.cache/$generatedColors/discord-colors.css"
fi
if [ ! -f "$colorsPath" ]; then
print_err "Cannot access $colorsPath"
exit
fi
echo "[INFO] discord-colors.css path: $colorsPath"
for client in "${availableClients[@]}"; do
themecordPath="/home/$USER/.config/$client/themes/Themecord.css"
echo "/* This discord theme is generated by Themecord! */" > $themecordPath
echo :root { >> $themecordPath
cat $colorsPath | while IFS= read -r line; do echo -e "\n\t"$line >> $themecordPath; done
if [[ -v themecordFiller ]]; then
printf '%s\n' "$themecordFiller" >> $themecordPath
else
print_err "Cannot access \$themecordFiller content."
fi
printf "%s\n" "$themecordBase" >> $themecordPath
done