st-xtheme-20220213-170120.st-0.8.5.diff (11614B)
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/st-defaults.h b/themes/st-defaults.h 324 new file mode 100644 325 index 0000000..d9c6cfa 326 --- /dev/null 327 +++ b/themes/st-defaults.h 328 @@ -0,0 +1,22 @@ 329 +# define ST_FONT "Liberation Mono:pixelsize=12:antialias=true:autohint=true" 330 +# define ST_ALPHA 1 331 +# define ST_FOREGROUND "gray90" 332 +# define ST_BACKGROUND "black" 333 +# define ST_CURSORCOLOR "#cccccc" 334 +# define ST_REVCURCOLOR "#555555" 335 +# define ST_COLOR0 "black" 336 +# define ST_COLOR1 "red3" 337 +# define ST_COLOR2 "green3" 338 +# define ST_COLOR3 "yellow3" 339 +# define ST_COLOR4 "blue2" 340 +# define ST_COLOR5 "magenta3" 341 +# define ST_COLOR6 "cyan3" 342 +# define ST_COLOR7 "gray90" 343 +# define ST_COLOR8 "gray50" 344 +# define ST_COLOR9 "red" 345 +# define ST_COLOR10 "green" 346 +# define ST_COLOR11 "yellow" 347 +# define ST_COLOR12 "#5c5cff" 348 +# define ST_COLOR13 "magenta" 349 +# define ST_COLOR14 "cyan" 350 +# define ST_COLOR15 "white" 351 diff --git a/themes/sweetlove.h b/themes/sweetlove.h 352 new file mode 100644 353 index 0000000..5c85bd0 354 --- /dev/null 355 +++ b/themes/sweetlove.h 356 @@ -0,0 +1,19 @@ 357 +# define ST_FOREGROUND "#c0b18b" 358 +# define ST_BACKGROUND "#1f1f1f" 359 +# define ST_CURSORCOLOR "#c0b18b" 360 +# define ST_COLOR0 "#4a3637" 361 +# define ST_COLOR1 "#d17b49" 362 +# define ST_COLOR2 "#7b8748" 363 +# define ST_COLOR3 "#af865a" 364 +# define ST_COLOR4 "#535c5c" 365 +# define ST_COLOR5 "#775759" 366 +# define ST_COLOR6 "#6d715e" 367 +# define ST_COLOR7 "#c0b18b" 368 +# define ST_COLOR8 "#402e2e" 369 +# define ST_COLOR9 "#ac5d2f" 370 +# define ST_COLOR10 "#647035" 371 +# define ST_COLOR11 "#8f6840" 372 +# define ST_COLOR12 "#444b4b" 373 +# define ST_COLOR13 "#614445" 374 +# define ST_COLOR14 "#585c49" 375 +# define ST_COLOR15 "#978965" 376 diff --git a/themesetup b/themesetup 377 new file mode 100755 378 index 0000000..e8710c1 379 --- /dev/null 380 +++ b/themesetup 381 @@ -0,0 +1,5 @@ 382 +#!/bin/sh 383 + 384 +echo \# if $(cat theme.h | cut -d' ' -f3 | sed "s/^/defined /;s/$/ ||/" | tr "\n" " ") 0 > theme_beg.h 385 +echo -e "# error (conflicting macro names)\n# endif" >> theme_beg.h 386 +cat theme.h | cut -d' ' -f3 | sed "s/^/# undef /;" > theme_end.h 387 diff --git a/xresources.list b/xresources.list 388 new file mode 100644 389 index 0000000..5eaf27c 390 --- /dev/null 391 +++ b/xresources.list 392 @@ -0,0 +1,22 @@ 393 +F alpha 394 +S font 395 +S foreground 396 +S background 397 +S cursorColor 398 +S revCurColor 399 +S color0 400 +S color1 401 +S color2 402 +S color3 403 +S color4 404 +S color5 405 +S color6 406 +S color7 407 +S color8 408 +S color9 409 +S color10 410 +S color11 411 +S color12 412 +S color13 413 +S color14 414 +S color15 415 diff --git a/xtheme b/xtheme 416 new file mode 100755 417 index 0000000..c1412a3 418 --- /dev/null 419 +++ b/xtheme 420 @@ -0,0 +1,48 @@ 421 +#!/bin/sh 422 + 423 +prefix=st 424 +resfile=xresources.list 425 +themeout=theme.h 426 +themedefaults=themes/st-defaults.h 427 + 428 +rm -f $themeout 429 + 430 +cat "$resfile" | while read T R A 431 +do 432 + m=$(echo "$prefix"'_'"$R" | tr '[:lower:]' '[:upper:]') 433 + 434 + s='' 435 + [[ "$T" == "S" ]] && s=\" 436 + 437 + l='' 438 + 439 + for r in "$R" "$A" 440 + do 441 + [[ "$r" == '' ]] && continue 442 + 443 + e=0 444 + 445 + for p in "$prefix" '' 446 + do 447 + l="$( \ 448 + xrdb -query \ 449 + | grep -P "^$p\*?\.?$r:\s*\S*$" -m 1 \ 450 + | sed "s/^$p\*\?\.\?$r:\s*\(\S*\)$/# define $m $s\1$s/" \ 451 + )" 452 + 453 + if [[ "$l" != '' ]] 454 + then 455 + e=1 456 + echo "$l" >> $themeout 457 + break 458 + fi 459 + done 460 + 461 + [[ $e == 1 ]] && break 462 + done 463 + 464 + if [[ "$l" == '' ]] 465 + then 466 + cat "$themedefaults" | grep -P "^# define $m " -m 1 >> $themeout 467 + fi 468 +done