sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

st-xtheme-20220211-234150-st-0.8.5.diff (11459B)


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