[download]

local/bin/theme

   1 #!/bin/bash
   2 #         ░███████
   3 #       ░███████       D O T F I L E S
   4 #       ░███████       T H E M E
   5 #    ░█████████████
   6 #       ░███████
   7 #       ░███████       LGPL <http://www.gnu.org/licenses/>
   8 #       ░██  ░██
   9 #       ░██  ░██   (C) 2018-2020 Alexey Gagin <http://www.lexa.by/dotfiles/>
  10 
  11 declare -A base16_ashes=( # {{{
  12     [background]='#1c2023'
  13     [foreground]='#c7ccd1'
  14     [color0]='#1c2023'
  15     [color1]='#c7ae95'
  16     [color2]='#95c7ae'
  17     [color3]='#aec795'
  18     [color4]='#ae95c7'
  19     [color5]='#c795ae'
  20     [color6]='#95aec7'
  21     [color7]='#c7ccd1'
  22     [color8]='#747c84'
  23     [color9]='#c7ae95'
  24     [color10]='#95c7ae'
  25     [color11]='#aec795'
  26     [color12]='#ae95c7'
  27     [color13]='#c795ae'
  28     [color14]='#95aec7'
  29     [color15]='#f3f4f5'
  30 ) # }}}
  31 declare -A base16_default=( # {{{
  32     [background]='#181818'
  33     [foreground]='#d8d8d8'
  34     [cursor]='#d8d8d8'
  35     [color0]='#181818'
  36     [color1]='#ab4642'
  37     [color2]='#a1b56c'
  38     [color3]='#f7ca88'
  39     [color4]='#7cafc2'
  40     [color5]='#ba8baf'
  41     [color6]='#86c1b9'
  42     [color7]='#d8d8d8'
  43     [color8]='#585858'
  44     [color9]='#ab4642'
  45     [color10]='#a1b56c'
  46     [color11]='#f7ca88'
  47     [color12]='#7cafc2'
  48     [color13]='#ba8baf'
  49     [color14]='#86c1b9'
  50     [color15]='#f8f8f8'
  51 ) # }}}
  52 declare -A base16_dracula=( # {{{
  53     [background]='#282936'
  54     [foreground]='#e9e9f4'
  55     [color0]='#282936'
  56     [color1]='#ea51b2'
  57     [color2]='#00f769'
  58     [color3]='#ebff87'
  59     [color4]='#62d6e8'
  60     [color5]='#b45bcf'
  61     [color6]='#a1efe4'
  62     [color7]='#e9e9f4'
  63     [color8]='#4d4f68'
  64     [color9]='#ea51b2'
  65     [color10]='#00f769'
  66     [color11]='#ebff87'
  67     [color12]='#62d6e8'
  68     [color13]='#b45bcf'
  69     [color14]='#a1efe4'
  70     [color15]='#f7f7fb'
  71 ) # }}}
  72 declare -A base16_eighties=( # {{{
  73     [background]='#2d2d2d'
  74     [foreground]='#d3d0c8'
  75     [color0]='#2d2d2d'
  76     [color1]='#f2777a'
  77     [color2]='#99cc99'
  78     [color3]='#ffcc66'
  79     [color4]='#6699cc'
  80     [color5]='#cc99cc'
  81     [color6]='#66cccc'
  82     [color7]='#d3d0c8'
  83     [color8]='#747369'
  84     [color9]='#f2777a'
  85     [color10]='#99cc99'
  86     [color11]='#ffcc66'
  87     [color12]='#6699cc'
  88     [color13]='#cc99cc'
  89     [color14]='#66cccc'
  90     [color15]='#f2f0ec'
  91 ) # }}}
  92 declare -A base16_flat=( # {{{
  93     [background]='#2c3e50'
  94     [foreground]='#e0e0e0'
  95     [color0]='#2c3e50'
  96     [color1]='#e74c3c'
  97     [color2]='#2ecc71'
  98     [color3]='#f1c40f'
  99     [color4]='#3498db'
 100     [color5]='#9b59b6'
 101     [color6]='#1abc9c'
 102     [color7]='#e0e0e0'
 103     [color8]='#95a5a6'
 104     [color9]='#e74c3c'
 105     [color10]='#2ecc71'
 106     [color11]='#f1c40f'
 107     [color12]='#3498db'
 108     [color13]='#9b59b6'
 109     [color14]='#1abc9c'
 110     [color15]='#ecf0f1'
 111 ) # }}}
 112 declare -A base16_gruvbox_hard=( # {{{
 113     [background]='#1d2021'
 114     [foreground]='#d5c4a1'
 115     [color0]='#1d2021'
 116     [color1]='#fb4934'
 117     [color2]='#b8bb26'
 118     [color3]='#fabd2f'
 119     [color4]='#83a598'
 120     [color5]='#d3869b'
 121     [color6]='#8ec07c'
 122     [color7]='#d5c4a1'
 123     [color8]='#665c54'
 124     [color9]='#fb4934'
 125     [color10]='#b8bb26'
 126     [color11]='#fabd2f'
 127     [color12]='#83a598'
 128     [color13]='#d3869b'
 129     [color14]='#8ec07c'
 130     [color15]='#fbf1c7'
 131 ) # }}}
 132 declare -A base16_gruvbox_medium=( # {{{
 133     [background]='#282828'
 134     [foreground]='#d5c4a1'
 135     [color0]='#282828'
 136     [color1]='#fb4934'
 137     [color2]='#b8bb26'
 138     [color3]='#fabd2f'
 139     [color4]='#83a598'
 140     [color5]='#d3869b'
 141     [color6]='#8ec07c'
 142     [color7]='#d5c4a1'
 143     [color8]='#665c54'
 144     [color9]='#fb4934'
 145     [color10]='#b8bb26'
 146     [color11]='#fabd2f'
 147     [color12]='#83a598'
 148     [color13]='#d3869b'
 149     [color14]='#8ec07c'
 150     [color15]='#fbf1c7'
 151 ) # }}}
 152 declare -A base16_gruvbox_pale=( # {{{
 153     [background]='#262626'
 154     [foreground]='#dab997'
 155     [color0]='#262626'
 156     [color1]='#d75f5f'
 157     [color2]='#afaf00'
 158     [color3]='#ffaf00'
 159     [color4]='#83adad'
 160     [color5]='#d485ad'
 161     [color6]='#85ad85'
 162     [color7]='#dab997'
 163     [color8]='#8a8a8a'
 164     [color9]='#d75f5f'
 165     [color10]='#afaf00'
 166     [color11]='#ffaf00'
 167     [color12]='#83adad'
 168     [color13]='#d485ad'
 169     [color14]='#85ad85'
 170     [color15]='#ebdbb2'
 171 ) # }}}
 172 declare -A base16_gruvbox_soft=( # {{{
 173     [background]='#32302f'
 174     [foreground]='#d5c4a1'
 175     [color0]='#32302f'
 176     [color1]='#fb4934'
 177     [color2]='#b8bb26'
 178     [color3]='#fabd2f'
 179     [color4]='#83a598'
 180     [color5]='#d3869b'
 181     [color6]='#8ec07c'
 182     [color7]='#d5c4a1'
 183     [color8]='#665c54'
 184     [color9]='#fb4934'
 185     [color10]='#b8bb26'
 186     [color11]='#fabd2f'
 187     [color12]='#83a598'
 188     [color13]='#d3869b'
 189     [color14]='#8ec07c'
 190     [color15]='#fbf1c7'
 191 ) # }}}
 192 declare -A base16_materia=( # {{{
 193     [background]='#263238'
 194     [foreground]='#cdd3de'
 195     [color0]='#263238'
 196     [color1]='#ec5f67'
 197     [color2]='#8bd649'
 198     [color3]='#ffcc00'
 199     [color4]='#89ddff'
 200     [color5]='#82aaff'
 201     [color6]='#80cbc4'
 202     [color7]='#cdd3de'
 203     [color8]='#707880'
 204     [color9]='#ec5f67'
 205     [color10]='#8bd649'
 206     [color11]='#ffcc00'
 207     [color12]='#89ddff'
 208     [color13]='#82aaff'
 209     [color14]='#80cbc4'
 210     [color15]='#ffffff'
 211 ) # }}}
 212 declare -A base16_material=( # {{{
 213     [background]='#263238'
 214     [foreground]='#eeffff'
 215     [color0]='#263238'
 216     [color1]='#f07178'
 217     [color2]='#c3e88d'
 218     [color3]='#ffcb6b'
 219     [color4]='#82aaff'
 220     [color5]='#c792ea'
 221     [color6]='#89ddff'
 222     [color7]='#eeffff'
 223     [color8]='#546e7a'
 224     [color9]='#f07178'
 225     [color10]='#c3e88d'
 226     [color11]='#ffcb6b'
 227     [color12]='#82aaff'
 228     [color13]='#c792ea'
 229     [color14]='#89ddff'
 230     [color15]='#ffffff'
 231 ) # }}}
 232 declare -A base16_material_palenight=( # {{{
 233     [background]='#292d3e'
 234     [foreground]='#959dcb'
 235     [color0]='#292d3e'
 236     [color1]='#f07178'
 237     [color2]='#c3e88d'
 238     [color3]='#ffcb6b'
 239     [color4]='#82aaff'
 240     [color5]='#c792ea'
 241     [color6]='#89ddff'
 242     [color7]='#959dcb'
 243     [color8]='#676e95'
 244     [color9]='#f07178'
 245     [color10]='#c3e88d'
 246     [color11]='#ffcb6b'
 247     [color12]='#82aaff'
 248     [color13]='#c792ea'
 249     [color14]='#89ddff'
 250     [color15]='#ffffff'
 251 ) # }}}
 252 declare -A base16_materialer=( # {{{
 253     [background]='#212121'
 254     [foreground]='#eeffff'
 255     [color0]='#212121'
 256     [color1]='#f07178'
 257     [color2]='#c3e88d'
 258     [color3]='#ffcb6b'
 259     [color4]='#82aaff'
 260     [color5]='#c792ea'
 261     [color6]='#89ddff'
 262     [color7]='#eeffff'
 263     [color8]='#4a4a4a'
 264     [color9]='#f07178'
 265     [color10]='#c3e88d'
 266     [color11]='#ffcb6b'
 267     [color12]='#82aaff'
 268     [color13]='#c792ea'
 269     [color14]='#89ddff'
 270     [color15]='#ffffff'
 271 ) # }}}
 272 declare -A base16_mocha=( # {{{
 273     [background]='#3b3228'
 274     [foreground]='#d0c8c6'
 275     [color0]='#3b3228'
 276     [color1]='#cb6077'
 277     [color2]='#beb55b'
 278     [color3]='#f4bc87'
 279     [color4]='#8ab3b5'
 280     [color5]='#a89bb9'
 281     [color6]='#7bbda4'
 282     [color7]='#d0c8c6'
 283     [color8]='#7e705a'
 284     [color9]='#cb6077'
 285     [color10]='#beb55b'
 286     [color11]='#f4bc87'
 287     [color12]='#8ab3b5'
 288     [color13]='#a89bb9'
 289     [color14]='#7bbda4'
 290     [color15]='#f5eeeb'
 291 ) # }}}
 292 declare -A base16_nord=( # {{{
 293     [background]='#2e3440'
 294     [foreground]='#e5e9f0'
 295     [color0]='#2e3440'
 296     [color1]='#88c0d0'
 297     [color2]='#bf616a'
 298     [color3]='#5e81ac'
 299     [color4]='#ebcb8b'
 300     [color5]='#a3be8c'
 301     [color6]='#d08770'
 302     [color7]='#e5e9f0'
 303     [color8]='#4c566a'
 304     [color9]='#88c0d0'
 305     [color10]='#bf616a'
 306     [color11]='#5e81ac'
 307     [color12]='#ebcb8b'
 308     [color13]='#a3be8c'
 309     [color14]='#d08770'
 310     [color15]='#8fbcbb'
 311 ) # }}}
 312 declare -A base16_ocean=( # {{{
 313     [background]='#2b303b'
 314     [foreground]='#c0c5ce'
 315     [color0]='#2b303b'
 316     [color1]='#bf616a'
 317     [color2]='#a3be8c'
 318     [color3]='#ebcb8b'
 319     [color4]='#8fa1b3'
 320     [color5]='#b48ead'
 321     [color6]='#96b5b4'
 322     [color7]='#c0c5ce'
 323     [color8]='#65737e'
 324     [color9]='#bf616a'
 325     [color10]='#a3be8c'
 326     [color11]='#ebcb8b'
 327     [color12]='#8fa1b3'
 328     [color13]='#b48ead'
 329     [color14]='#96b5b4'
 330     [color15]='#eff1f5'
 331 ) # }}}
 332 declare -A base16_oceanicnext=( # {{{
 333     [background]='#1b2b34'
 334     [foreground]='#c0c5ce'
 335     [color0]='#1b2b34'
 336     [color1]='#ec5f67'
 337     [color2]='#99c794'
 338     [color3]='#fac863'
 339     [color4]='#6699cc'
 340     [color5]='#c594c5'
 341     [color6]='#5fb3b3'
 342     [color7]='#c0c5ce'
 343     [color8]='#65737e'
 344     [color9]='#ec5f67'
 345     [color10]='#99c794'
 346     [color11]='#fac863'
 347     [color12]='#6699cc'
 348     [color13]='#c594c5'
 349     [color14]='#5fb3b3'
 350     [color15]='#d8dee9'
 351 ) # }}}
 352 declare -A base16_porple=( # {{{
 353     [background]='#292c36'
 354     [foreground]='#d8d8d8'
 355     [color0]='#292c36'
 356     [color1]='#f84547'
 357     [color2]='#95c76f'
 358     [color3]='#efa16b'
 359     [color4]='#8485ce'
 360     [color5]='#b74989'
 361     [color6]='#64878f'
 362     [color7]='#d8d8d8'
 363     [color8]='#65568a'
 364     [color9]='#f84547'
 365     [color10]='#95c76f'
 366     [color11]='#efa16b'
 367     [color12]='#8485ce'
 368     [color13]='#b74989'
 369     [color14]='#64878f'
 370     [color15]='#f8f8f8'
 371 ) # }}}
 372 declare -A base16_rebecca=( # {{{
 373     [background]='#292a44'
 374     [foreground]='#f1eff8'
 375     [color0]='#292a44'
 376     [color1]='#a0a0c5'
 377     [color2]='#6dfedf'
 378     [color3]='#ae81ff'
 379     [color4]='#2de0a7'
 380     [color5]='#7aa5ff'
 381     [color6]='#8eaee0'
 382     [color7]='#f1eff8'
 383     [color8]='#666699'
 384     [color9]='#a0a0c5'
 385     [color10]='#6dfedf'
 386     [color11]='#ae81ff'
 387     [color12]='#2de0a7'
 388     [color13]='#7aa5ff'
 389     [color14]='#8eaee0'
 390     [color15]='#53495d'
 391 ) # }}}
 392 declare -A base16_tomorrow_night=( # {{{
 393     [background]='#1d1f21'
 394     [foreground]='#c5c8c6'
 395     [color0]='#1d1f21'
 396     [color1]='#cc6666'
 397     [color2]='#b5bd68'
 398     [color3]='#f0c674'
 399     [color4]='#81a2be'
 400     [color5]='#b294bb'
 401     [color6]='#8abeb7'
 402     [color7]='#c5c8c6'
 403     [color8]='#969896'
 404     [color9]='#cc6666'
 405     [color10]='#b5bd68'
 406     [color11]='#f0c674'
 407     [color12]='#81a2be'
 408     [color13]='#b294bb'
 409     [color14]='#8abeb7'
 410     [color15]='#ffffff'
 411 ) # }}}
 412 declare -A default=( # {{{
 413     [background]='#222228'
 414     [foreground]='#d8dade'
 415     [color0]='#222228'
 416     [color1]='#ff5f5f'
 417     [color2]='#87af5f'
 418     [color3]='#d7af87'
 419     [color4]='#5f5fff'
 420     [color5]='#d75fff'
 421     [color6]='#87d7d7'
 422     [color7]='#a8aaae'
 423     [color8]='#4e4e56' # #37373f
 424     [color9]='#ff5f5f'
 425     [color10]='#87af5f'
 426     [color11]='#d7af87' # #ffd75f
 427     [color12]='#afafd7'
 428     [color13]='#d75fff'
 429     [color14]='#87d7d6'
 430     [color15]='#d8dade'
 431 ) # }}}
 432 declare -A dkeg_prevail=( # {{{
 433     [background]='#263139'
 434     [foreground]='#ffffff' # #dac99d
 435     [color0]='#263139'
 436     [color1]='#f36f62'
 437     [color2]='#c5e19c'
 438     [color3]='#ccb478'
 439     [color4]='#4c7e89'
 440     [color5]='#814d61'
 441     [color6]='#79a69d'
 442     [color7]='#c4c4b5'
 443     [color8]='#455867'
 444     [color9]='#f36f62'
 445     [color10]='#c5e19c'
 446     [color11]='#ccb478'
 447     [color12]='#4c7e89'
 448     [color13]='#814d61'
 449     [color14]='#79a69d'
 450     [color15]='#dbdbd1'
 451 ) # }}}
 452 declare -A dkeg_simplicity=( # {{{
 453     [background]='#28282c'
 454     [foreground]='#a18673'
 455     [color0]='#28282c'
 456     [color1]='#bf5c56'
 457     [color2]='#bf5c56'
 458     [color3]='#97b19c'
 459     [color4]='#97b19c'
 460     [color5]='#d7bd8a'
 461     [color6]='#d7bd8a'
 462     [color7]='#f4f4f2' # #545f72
 463     [color8]='#404047'
 464     [color9]='#bf5c56'
 465     [color10]='#bf5c56'
 466     [color11]='#97b19c'
 467     [color12]='#97b19c'
 468     [color13]='#d7bd8a'
 469     [color14]='#d7bd8a'
 470     [color15]='#f4f4f2'
 471 ) # }}}
 472 declare -A hybrid_material=( # {{{
 473     [background]='#263238'
 474     [foreground]='#ffffff'
 475     [color0]='#263238'
 476     [color1]='#cc6666'
 477     [color2]='#f0c674'
 478     [color3]='#b5bd68'
 479     [color4]='#8abeb7'
 480     [color5]='#81a2be'
 481     [color6]='#b294bb'
 482     [color7]='#ffffff'
 483     [color8]='#707880'
 484     [color9]='#cc6666'
 485     [color10]='#f0c674'
 486     [color11]='#b5bd68'
 487     [color12]='#8abeb7'
 488     [color13]='#81a2be'
 489     [color14]='#b294bb'
 490     [color15]='#ffffff'
 491 ) # }}}
 492 declare -A monokai=( # {{{
 493     [background]='#272822'
 494     [foreground]='#f8f8f2'
 495     [color0]='#272822'
 496     [color1]='#f92672'
 497     [color2]='#a6e22e'
 498     [color3]='#f4bf75'
 499     [color4]='#66d9ef'
 500     [color5]='#ae81ff'
 501     [color6]='#a1efe4'
 502     [color7]='#f8f8f2'
 503     [color8]='#75715e'
 504     [color9]='#f92672'
 505     [color10]='#a6e22e'
 506     [color11]='#f4bf75'
 507     [color12]='#66d9ef'
 508     [color13]='#ae81ff'
 509     [color14]='#a1efe4'
 510     [color15]='#f8f8f2'
 511 ) # }}}
 512 declare -A solarized=( # {{{
 513     [background]='#073642'
 514     [foreground]='#fdf6e3'
 515     [color0]='#073642'
 516     [color1]='#dc322f'
 517     [color2]='#859900'
 518     [color3]='#b58900'
 519     [color4]='#268bd2'
 520     [color5]='#d33682'
 521     [color6]='#2aa198'
 522     [color7]='#eee8d5'
 523     [color8]='#6c7c80'
 524     [color9]='#dc322f'
 525     [color10]='#859900'
 526     [color11]='#b58900'
 527     [color12]='#268bd2'
 528     [color13]='#d33682'
 529     [color14]='#2aa198'
 530     [color15]='#eee8d5'
 531 ) # }}}
 532 declare -A zenburn3=( # {{{
 533     [background]='#3f3f3f'
 534     [foreground]='#ffffff'
 535     [color0]='#3f3f3f'
 536     [color1]='#dca5a5'
 537     [color2]='#c0e380'
 538     [color3]='#e4e49a'
 539     [color4]='#7d9ec0'
 540     [color5]='#ffc66d'
 541     [color6]='#8acccf'
 542     [color7]='#ffffff'
 543     [color8]='#828282'
 544     [color9]='#dca5a5'
 545     [color10]='#c0e380'
 546     [color11]='#e4e49a'
 547     [color12]='#7d9ec0'
 548     [color13]='#ffc66d'
 549     [color14]='#8acccf'
 550     [color15]='#ffffff'
 551 ) # }}}
 552 
 553 return 2>&-
 554 
 555 declare -A gtk=( # {{{
 556     [Amber]=yellow
 557     [Blue]=blue
 558     [BlueGrey]=bluegrey
 559     [Brown]=brown
 560     [Cyan]=cyan
 561     [DeepOrange]=deeporange
 562     [DeepPurple]=violet
 563     [Green]=green
 564     [Grey]=grey
 565     [Indigo]=indigo
 566     [LightBlue]=blue
 567     [Lime]=nordic
 568     [Orange]=orange
 569     [Pink]=pink
 570     [Purple]=magenta
 571     [Red]=red
 572     [Teal]=teal
 573 ) # }}}
 574 
 575 declare -n colors=default
 576 source ~/.theme/colors.sh 2>&- &&
 577 for i in {back,fore}ground color{0..15}; do colors[$i]=${!i}; done
 578 
 579 ################################################################################
 580 
 581 case $1 in
 582     -r|--reload) reload=1;;
 583 
 584     -b|--background)
 585         cp "$2" ~/.theme/background.jpg
 586         hsetroot -solid ${colors[background]} -fill $_
 587 
 588         qdbus --system org.freedesktop.Accounts /org/freedesktop/Accounts/User$UID \
 589         org.freedesktop.DisplayManager.AccountsService.BackgroundFile $_
 590 
 591         exit
 592     ;;
 593 
 594     -c|--colors)
 595         source $0; reload=1; declare -n colors=$2 2>&-
 596         list(){ source $0; local | grep -io "^\w*$1\w*"; }
 597         [[ ! $2 || ! ${colors[@]} ]] && { list "$2"; exit; }
 598     ;;
 599 
 600     -w|--wal)
 601         [[ -f $2 ]] && wal -qnstei "$2" && $0 -b "$2" || wal -qnste --theme "${@:2}"
 602         [[    $2 ]] && cp ~/.cache/wal/colors.sh ~/.theme/ && $0 -r
 603         exit
 604     ;;
 605 
 606     -g|--gtk)
 607         [[ $2 && ${gtk[$2]} ]] && papirus-folders -C ${gtk[$2]} > /dev/null
 608         [[ $? != 0 ]] && printf '%s\n' ${!gtk[@]} | sort && exit
 609 
 610         [[ $2 == Cyan ]] &&
 611         xfconf-query -c xsettings -p /Net/ThemeName     -s Adapta ||
 612         xfconf-query -c xsettings -p /Net/ThemeName     -s Adapta-$2
 613 
 614         xfconf-query -c xsettings -p /Net/IconThemeName -s Papirus && sleep 0.5
 615         xfconf-query -c xsettings -p /Net/IconThemeName -s ePapirus
 616 
 617         exit
 618     ;;
 619 
 620     -e|--export)
 621         g=$(xfconf-query -c xsettings -p /Net/ThemeName | cut -b 8-)
 622         c(){ source $0; local | grep $background | grep $color1 | cut -d = -f 1; }
 623         b=$(du -ab ~/.theme/background.jpg ~/Wallpapers | awk 'a[$1]++ { print $2 }')
 624 
 625         echo ${0##*/} -c $(c)
 626         echo ${0##*/} -g $g
 627         echo ${0##*/} -b ${b/~/\~}
 628         exit
 629     ;;
 630 
 631     -C|--rand-colors    ) $0 -c $($0 -c | shuf -n 1); exit;;
 632     -G|--rand-gtk       ) $0 -g $($0 -g | shuf -n 1); exit;;
 633     -B|--rand-background) $0 -b $(find ~/Wallpapers | shuf -n 1); exit;;
 634     -W|--rand-wal       ) $0 -w $($0 -w | grep '^\s-' | cut -b 4- | shuf -n 1); exit;;
 635 esac
 636 
 637 mkdir -p ~/.theme && cd $_
 638 
 639 ################################################################################
 640 
 641 print(){ # {{{
 642     printf "${2:-%s}\n" "$(for i in ${!colors[@]}; do printf "$1\n" $i "${colors[$i]}"; done)"
 643 } # }}}
 644 rgba(){ # {{{
 645     printf 'rgba(%d, %d, %d, 0.%d)' 0x${1:1:2} 0x${1:3:2} 0x${1:5:2} $(( 0x${1:7:2} * 1000 / 255 ))
 646 } # }}}
 647 
 648 [[ ${colors[foreground]} < ${colors[color7]}  ]] && colors[foreground]=${colors[color7]}
 649 [[ ${colors[foreground]} < ${colors[color15]} ]] && colors[foreground]=${colors[color15]}
 650 
 651 colors[background_rgba]=${colors[background]}e0
 652 colors[background_argb]=${colors[background]/\#/\#e0}
 653 
 654 > colors.xres print '*%s: %s'
 655 > colors.lua  print '%s = "%s";'
 656 > colors.vim  print 'let %s = "%s"'
 657 > colors.sh   print 'export %s="%s"'
 658 > colors.h    print 'char %s[] = "%s";'
 659 > colors.ini  print '%s = %s' '[colors]\n%s'
 660 
 661 colors[background-rgba]=$(rgba ${colors[background_rgba]})
 662 unset colors[background_rgba] colors[background_argb]
 663 
 664 > colors.gtk  print '@define-color %s %s;'
 665 > colors.rasi print '  %s: %s;' '* {\n%s\n}'
 666 > colors.css  print '  --%s: %s;' ':root {\n%s\n}'
 667 
 668 > colors-xterm printf '\e]%s;%s\a' \
 669 10 ${colors[foreground]}      11 ${colors[background]} \
 670 12 ${colors[foreground]} '4;256' ${colors[foreground]} \
 671 $(for i in {0..15}; do echo "4;$i" ${colors[color$i]}; done)
 672 
 673 colors[color7]=${colors[foreground]}
 674 > colors-linux printf '\e]P%x%s\a' $(for i in {0..7}; do echo $i ${colors[color$i]:1}; done)
 675 
 676 ################################################################################
 677 
 678 printf '\e[1;30m'
 679 trap 'printf "\e[0m"; colors' EXIT
 680 
 681 source colors.sh
 682 
 683 xrdb -merge colors.xres
 684 xrdb -merge ~/.config/xresrc
 685 
 686 $0 -b background.jpg  &
 687 test -f $_ || filvice &
 688 
 689 find ~/.config ~/.local -name \*.theme |
 690 while read f; do envsubst < $f > ${f%.theme}; done
 691 
 692 [[ $reload ]] || exit
 693 
 694 i3 restart
 695 killall dunst
 696 
 697 killall -HUP  dwm awesome xfwm4
 698 killall -USR1 openbox; sleep 0.5
 699 killall -USR1 sxhkd polybar xfce4-panel
 700 
 701 cmp -s background.jpg ~/.cache/filvice.png && filvice &
 702 
 703 for i in /dev/pts/[0-9]; do cat colors-xterm > $i; done
 704 for i in /dev/tty[0-9];  do cat colors-linux > $i; done 2>&-
 705 
 706 vim --serverlist | xargs -I % vim --servername % --remote-send \
 707 '<Esc>:if has("gui_running") | so ~/.vim/gvimrc | endif<Cr>'