st-xtheme-20220218-001337-st-0.8.5.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
st-xtheme-20220218-001337-st-0.8.5.diff (12001B)
---
1 diff --git a/Makefile b/Makefile
2 index 470ac86..b095566 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -15,8 +15,14 @@ options:
6 @echo "LDFLAGS = $(STLDFLAGS)"
7 @echo "CC = $(CC)"
8
9 -config.h:
10 - cp config.def.h config.h
11 +theme.h:
12 + ./xtheme
13 +
14 +theme_beg.h:
15 + ./themesetup
16 +
17 +config.h: theme.h
18 + cp -n config.def.h config.h
19
20 .c.o:
21 $(CC) $(STCFLAGS) -c $<
22 @@ -24,13 +30,14 @@ config.h:
23 st.o: config.h st.h win.h
24 x.o: arg.h config.h st.h win.h
25
26 -$(OBJ): config.h config.mk
27 +$(OBJ): config.h theme_beg.h config.mk
28
29 st: $(OBJ)
30 $(CC) -o $@ $(OBJ) $(STLDFLAGS)
31 + rm -f theme_{beg,end}.h
32
33 clean:
34 - rm -f st $(OBJ) st-$(VERSION).tar.gz
35 + rm -f st $(OBJ) theme_{beg,end}.h st-$(VERSION).tar.gz
36
37 dist: clean
38 mkdir -p st-$(VERSION)
39 diff --git a/config.def.h b/config.def.h
40 index 91ab8ca..084710e 100644
41 --- a/config.def.h
42 +++ b/config.def.h
43 @@ -1,11 +1,15 @@
44 /* See LICENSE file for copyright and license details. */
45
46 +/* theme management */
47 +# include "theme_beg.h" /* this is a compile-time generated header file */
48 +# include "theme.h"
49 +
50 /*
51 * appearance
52 *
53 * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
54 */
55 -static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
56 +static char *font = ST_FONT;
57 static int borderpx = 2;
58
59 /*
60 @@ -93,37 +97,43 @@ char *termname = "st-256color";
61 */
62 unsigned int tabspaces = 8;
63
64 +/* bg opacity */
65 +float alpha = ST_ALPHA;
66 +
67 /* Terminal colors (16 first used in escape sequence) */
68 static const char *colorname[] = {
69 /* 8 normal colors */
70 - "black",
71 - "red3",
72 - "green3",
73 - "yellow3",
74 - "blue2",
75 - "magenta3",
76 - "cyan3",
77 - "gray90",
78 + ST_COLOR0,
79 + ST_COLOR1,
80 + ST_COLOR2,
81 + ST_COLOR3,
82 + ST_COLOR4,
83 + ST_COLOR5,
84 + ST_COLOR6,
85 + ST_COLOR7,
86
87 /* 8 bright colors */
88 - "gray50",
89 - "red",
90 - "green",
91 - "yellow",
92 - "#5c5cff",
93 - "magenta",
94 - "cyan",
95 - "white",
96 + ST_COLOR8,
97 + ST_COLOR9,
98 + ST_COLOR10,
99 + ST_COLOR11,
100 + ST_COLOR12,
101 + ST_COLOR13,
102 + ST_COLOR14,
103 + ST_COLOR15,
104
105 [255] = 0,
106
107 /* more colors can be added after 255 to use with DefaultXX */
108 - "#cccccc",
109 - "#555555",
110 - "gray90", /* default foreground colour */
111 - "black", /* default background colour */
112 + ST_CURSORCOLOR,
113 + ST_REVCURCOLOR,
114 + ST_FOREGROUND, /* default foreground colour */
115 + ST_BACKGROUND, /* default background colour */
116 };
117
118 +/* theme management */
119 +# include "theme_end.h" /* this is a compile-time generated header file */
120 +
121
122 /*
123 * Default colors (colorname index)
124 diff --git a/themes/Cyberpunk-Neon.h b/themes/Cyberpunk-Neon.h
125 new file mode 100644
126 index 0000000..d77a229
127 --- /dev/null
128 +++ b/themes/Cyberpunk-Neon.h
129 @@ -0,0 +1,18 @@
130 +# define ST_FOREGROUND "#0abdc6"
131 +# define ST_BACKGROUND "#000b1e"
132 +# define ST_COLOR0 "#123e7c"
133 +# define ST_COLOR1 "#ff0000"
134 +# define ST_COLOR2 "#d300c4"
135 +# define ST_COLOR3 "#f57800"
136 +# define ST_COLOR4 "#123e7c"
137 +# define ST_COLOR5 "#711c91"
138 +# define ST_COLOR6 "#0abdc6"
139 +# define ST_COLOR7 "#d7d7d5"
140 +# define ST_COLOR8 "#1c61c2"
141 +# define ST_COLOR9 "#ff0000"
142 +# define ST_COLOR10 "#d300c4"
143 +# define ST_COLOR11 "#f57800"
144 +# define ST_COLOR12 "#00ff00"
145 +# define ST_COLOR13 "#711c91"
146 +# define ST_COLOR14 "#0abdc6"
147 +# define ST_COLOR15 "#d7d7d5"
148 diff --git a/themes/catppuccin.h b/themes/catppuccin.h
149 new file mode 100644
150 index 0000000..6642319
151 --- /dev/null
152 +++ b/themes/catppuccin.h
153 @@ -0,0 +1,18 @@
154 +# define ST_FOREGROUND "#D9E0EE"
155 +# define ST_BACKGROUND "#1E1E2E"
156 +# define ST_COLOR0 "#6E6C7E"
157 +# define ST_COLOR1 "#F28FAD"
158 +# define ST_COLOR2 "#ABE9B3"
159 +# define ST_COLOR3 "#FAE3B0"
160 +# define ST_COLOR4 "#96CDFB"
161 +# define ST_COLOR5 "#DDB6F2"
162 +# define ST_COLOR6 "#F5C2E7"
163 +# define ST_COLOR7 "#C3BAC6"
164 +# define ST_COLOR8 "#988BA2"
165 +# define ST_COLOR9 "#F28FAD"
166 +# define ST_COLOR10 "#ABE9B3"
167 +# define ST_COLOR11 "#FAE3B0"
168 +# define ST_COLOR12 "#96CDFB"
169 +# define ST_COLOR13 "#DDB6F2"
170 +# define ST_COLOR14 "#F5C2E7"
171 +# define ST_COLOR15 "#D9E0EE"
172 diff --git a/themes/dracula.h b/themes/dracula.h
173 new file mode 100644
174 index 0000000..1961616
175 --- /dev/null
176 +++ b/themes/dracula.h
177 @@ -0,0 +1,18 @@
178 +# define ST_FOREGROUND "#F8F8F2"
179 +# define ST_BACKGROUND "#282A36"
180 +# define ST_COLOR0 "#000000"
181 +# define ST_COLOR1 "#FF5555"
182 +# define ST_COLOR2 "#50FA7B"
183 +# define ST_COLOR3 "#F1FA8C"
184 +# define ST_COLOR4 "#BD93F9"
185 +# define ST_COLOR5 "#FF79C6"
186 +# define ST_COLOR6 "#8BE9FD"
187 +# define ST_COLOR7 "#BFBFBF"
188 +# define ST_COLOR8 "#4D4D4D"
189 +# define ST_COLOR9 "#FF6E67"
190 +# define ST_COLOR10 "#5AF78E"
191 +# define ST_COLOR11 "#F4F99D"
192 +# define ST_COLOR12 "#CAA9FA"
193 +# define ST_COLOR13 "#FF92D0"
194 +# define ST_COLOR14 "#9AEDFE"
195 +# define ST_COLOR15 "#E6E6E6"
196 diff --git a/themes/dwan.h b/themes/dwan.h
197 new file mode 100644
198 index 0000000..6446c11
199 --- /dev/null
200 +++ b/themes/dwan.h
201 @@ -0,0 +1,19 @@
202 +# define ST_FOREGROUND "#9b9081"
203 +# define ST_BACKGROUND "#181b20"
204 +# define ST_CURSORCOLOR "#9b9081"
205 +# define ST_COLOR0 "#353535"
206 +# define ST_COLOR1 "#744b40"
207 +# define ST_COLOR2 "#6d6137"
208 +# define ST_COLOR3 "#765636"
209 +# define ST_COLOR4 "#61564b"
210 +# define ST_COLOR5 "#6b4a49"
211 +# define ST_COLOR6 "#435861"
212 +# define ST_COLOR7 "#b3b3b3"
213 +# define ST_COLOR8 "#5f5f5f"
214 +# define ST_COLOR9 "#785850"
215 +# define ST_COLOR10 "#6f6749"
216 +# define ST_COLOR11 "#776049"
217 +# define ST_COLOR12 "#696057"
218 +# define ST_COLOR13 "#6f5a59"
219 +# define ST_COLOR14 "#525f66"
220 +# define ST_COLOR15 "#cdcdcd"
221 diff --git a/themes/gruvbox-dark.h b/themes/gruvbox-dark.h
222 new file mode 100644
223 index 0000000..c7901e8
224 --- /dev/null
225 +++ b/themes/gruvbox-dark.h
226 @@ -0,0 +1,18 @@
227 +# define ST_FOREGROUND "#ebdbb2"
228 +# define ST_BACKGROUND "#282828"
229 +# define ST_COLOR0 "#282828"
230 +# define ST_COLOR1 "#cc241d"
231 +# define ST_COLOR2 "#98971a"
232 +# define ST_COLOR3 "#d79921"
233 +# define ST_COLOR4 "#458588"
234 +# define ST_COLOR5 "#b16286"
235 +# define ST_COLOR6 "#689d6a"
236 +# define ST_COLOR7 "#a89984"
237 +# define ST_COLOR8 "#928374"
238 +# define ST_COLOR9 "#fb4934"
239 +# define ST_COLOR10 "#b8bb26"
240 +# define ST_COLOR11 "#fabd2f"
241 +# define ST_COLOR12 "#83a598"
242 +# define ST_COLOR13 "#d3869b"
243 +# define ST_COLOR14 "#8ec07c"
244 +# define ST_COLOR15 "#ebdbb2"
245 diff --git a/themes/leet.h b/themes/leet.h
246 new file mode 100644
247 index 0000000..e149a2d
248 --- /dev/null
249 +++ b/themes/leet.h
250 @@ -0,0 +1,21 @@
251 +# define ST_ALPHA .75F
252 +# define ST_FOREGROUND "#FF0000"
253 +# define ST_BACKGROUND "#080000"
254 +# define ST_CURSORCOLOR "#D40000"
255 +# define ST_REVCURCOLOR "#FF0000"
256 +# define ST_COLOR0 "#010008"
257 +# define ST_COLOR1 "#A71B1A"
258 +# define ST_COLOR2 "#3B8526"
259 +# define ST_COLOR3 "#E49202"
260 +# define ST_COLOR4 "#1D576D"
261 +# define ST_COLOR5 "#97219C"
262 +# define ST_COLOR6 "#24866F"
263 +# define ST_COLOR7 "#B5AD64"
264 +# define ST_COLOR8 "#1C1C1C"
265 +# define ST_COLOR9 "#BF3130"
266 +# define ST_COLOR10 "#58A642"
267 +# define ST_COLOR11 "#FFB026"
268 +# define ST_COLOR12 "#4169E1"
269 +# define ST_COLOR13 "#A7248C"
270 +# define ST_COLOR14 "#37A48D"
271 +# define ST_COLOR15 "#CEC67D"
272 diff --git a/themes/redish.h b/themes/redish.h
273 new file mode 100644
274 index 0000000..51fedfc
275 --- /dev/null
276 +++ b/themes/redish.h
277 @@ -0,0 +1,20 @@
278 +# define ST_FOREGROUND "#FF0000"
279 +# define ST_BACKGROUND "#1C0F0F"
280 +# define ST_CURSORCOLOR "#D40000"
281 +# define ST_REVCURCOLOR "#FF0000"
282 +# define ST_COLOR0 "#1C0F11"
283 +# define ST_COLOR1 "#752323"
284 +# define ST_COLOR2 "#D96767"
285 +# define ST_COLOR3 "#FF0000"
286 +# define ST_COLOR4 "#523F3F"
287 +# define ST_COLOR5 "#993131"
288 +# define ST_COLOR6 "#B45050"
289 +# define ST_COLOR7 "#735050"
290 +# define ST_COLOR8 "#806060"
291 +# define ST_COLOR9 "#C02F2F"
292 +# define ST_COLOR10 "#D76262"
293 +# define ST_COLOR11 "#FF0000"
294 +# define ST_COLOR12 "#7E4F4F"
295 +# define ST_COLOR13 "#FF1111"
296 +# define ST_COLOR14 "#FF8A8A"
297 +# define ST_COLOR15 "#8C6161"
298 diff --git a/themes/solarized-dark.h b/themes/solarized-dark.h
299 new file mode 100644
300 index 0000000..4dabf4b
301 --- /dev/null
302 +++ b/themes/solarized-dark.h
303 @@ -0,0 +1,19 @@
304 +# define ST_FOREGROUND "#839496"
305 +# define ST_BACKGROUND "#002b36"
306 +# define ST_CURSORCOLOR "#93a1a1"
307 +# define ST_COLOR0 "#073642"
308 +# define ST_COLOR1 "#dc322f"
309 +# define ST_COLOR2 "#859900"
310 +# define ST_COLOR3 "#b58900"
311 +# define ST_COLOR4 "#268bd2"
312 +# define ST_COLOR5 "#d33682"
313 +# define ST_COLOR6 "#2aa198"
314 +# define ST_COLOR7 "#eee8d5"
315 +# define ST_COLOR8 "#002b36"
316 +# define ST_COLOR9 "#cb4b16"
317 +# define ST_COLOR10 "#586e75"
318 +# define ST_COLOR11 "#657b83"
319 +# define ST_COLOR12 "#839496"
320 +# define ST_COLOR13 "#6c71c4"
321 +# define ST_COLOR14 "#93a1a1"
322 +# define ST_COLOR15 "#fdf6e3"
323 diff --git a/themes/sweetlove.h b/themes/sweetlove.h
324 new file mode 100644
325 index 0000000..5c85bd0
326 --- /dev/null
327 +++ b/themes/sweetlove.h
328 @@ -0,0 +1,19 @@
329 +# define ST_FOREGROUND "#c0b18b"
330 +# define ST_BACKGROUND "#1f1f1f"
331 +# define ST_CURSORCOLOR "#c0b18b"
332 +# define ST_COLOR0 "#4a3637"
333 +# define ST_COLOR1 "#d17b49"
334 +# define ST_COLOR2 "#7b8748"
335 +# define ST_COLOR3 "#af865a"
336 +# define ST_COLOR4 "#535c5c"
337 +# define ST_COLOR5 "#775759"
338 +# define ST_COLOR6 "#6d715e"
339 +# define ST_COLOR7 "#c0b18b"
340 +# define ST_COLOR8 "#402e2e"
341 +# define ST_COLOR9 "#ac5d2f"
342 +# define ST_COLOR10 "#647035"
343 +# define ST_COLOR11 "#8f6840"
344 +# define ST_COLOR12 "#444b4b"
345 +# define ST_COLOR13 "#614445"
346 +# define ST_COLOR14 "#585c49"
347 +# define ST_COLOR15 "#978965"
348 diff --git a/themesetup b/themesetup
349 new file mode 100755
350 index 0000000..e8710c1
351 --- /dev/null
352 +++ b/themesetup
353 @@ -0,0 +1,5 @@
354 +#!/bin/sh
355 +
356 +echo \# if $(cat theme.h | cut -d' ' -f3 | sed "s/^/defined /;s/$/ ||/" | tr "\n" " ") 0 > theme_beg.h
357 +echo -e "# error (conflicting macro names)\n# endif" >> theme_beg.h
358 +cat theme.h | cut -d' ' -f3 | sed "s/^/# undef /;" > theme_end.h
359 diff --git a/xtable.md b/xtable.md
360 new file mode 100644
361 index 0000000..9f51f33
362 --- /dev/null
363 +++ b/xtable.md
364 @@ -0,0 +1,24 @@
365 +| TYPE | RESOURCE | DEFAULT VALUE | [ALTERNATIVE RESOURCE] |
366 +|:---------:|:-----------------:|:-----------------------------------------------------------------:|:-------------------------:|
367 +| S | font | Liberation Mono:pixelsize=12:antialias=true:autohint=true | |
368 +| F | alpha | 1 | |
369 +| S | foreground | gray90 | |
370 +| S | background | black | |
371 +| S | cursorColor | #cccccc | |
372 +| S | revCurColor | #555555 | |
373 +| S | color0 | black | |
374 +| S | color1 | red3 | |
375 +| S | color2 | green3 | |
376 +| S | color3 | yellow3 | |
377 +| S | color4 | blue2 | |
378 +| S | color5 | magenta3 | |
379 +| S | color6 | cyan3 | |
380 +| S | color7 | gray90 | |
381 +| S | color8 | gray50 | |
382 +| S | color9 | red | |
383 +| S | color10 | green | |
384 +| S | color11 | yellow | |
385 +| S | color12 | #5c5cff | |
386 +| S | color13 | magenta | |
387 +| S | color14 | cyan | |
388 +| S | color15 | white | |
389 diff --git a/xtheme b/xtheme
390 new file mode 100755
391 index 0000000..ff1cc3e
392 --- /dev/null
393 +++ b/xtheme
394 @@ -0,0 +1,63 @@
395 +#!/bin/sh
396 +
397 +prefix=st
398 +themeout=theme.h
399 +xtable=xtable.md
400 +
401 +rm -f $themeout
402 +
403 +set_resource ()
404 +{
405 + T=$1
406 + M=$2
407 + V=$3
408 +
409 + case $T in
410 + S)
411 + V=\"$V\"
412 + ;;
413 + SA)
414 + V="{\"$(echo $V | sed 's/, /", "/g')\"}"
415 + esac
416 +
417 + echo "# define $M $V" >> $themeout
418 +}
419 +
420 +cat "$xtable" |
421 + sed '1,2d;s/\(^|\t*\)\|\(|$\)//g;s/\t\+|\t\+/|/g' |
422 + while IFS='|' read T R D A
423 + do
424 + m=$(echo "$prefix"'_'"$R" | tr '[:lower:]' '[:upper:]')
425 +
426 + l=''
427 +
428 + for r in "$R" "$A"
429 + do
430 + [[ "$r" == '' ]] && continue
431 +
432 + e=0
433 +
434 + for p in "$prefix" ''
435 + do
436 + l="$( \
437 + xrdb -query \
438 + | grep -P "^$p\*?\.?$r:\s+\S+" | tail -n 1 \
439 + | sed 's/\s\+/ /g' | cut -d' ' -f 2 \
440 + )"
441 +
442 + if [[ "$l" != '' ]]
443 + then
444 + e=1
445 + set_resource $T $m "$l"
446 + break
447 + fi
448 + done
449 +
450 + [[ $e == 1 ]] && break
451 + done
452 +
453 + if [[ "$l" == '' ]]
454 + then
455 + set_resource $T $m "$D"
456 + fi
457 + done