[download]

local/bin/theme

   1 #!/bin/bash
   2 
   3 declare -A ashes_base16=( # {{{
   4     [background]='#1c2023' [foreground]='#c7ccd1'
   5         [color0]='#1c2023'     [color8]='#747c84'
   6         [color1]='#c7ae95'     [color9]='#c7ae95'
   7         [color2]='#95c7ae'    [color10]='#95c7ae'
   8         [color3]='#aec795'    [color11]='#aec795'
   9         [color4]='#ae95c7'    [color12]='#ae95c7'
  10         [color5]='#c795ae'    [color13]='#c795ae'
  11         [color6]='#95aec7'    [color14]='#95aec7'
  12         [color7]='#c7ccd1'    [color15]='#f3f4f5'
  13 ) # }}}
  14 declare -A blossom=( # {{{
  15     [background]='#2f3846' [foreground]='#ffffff' # [foreground]='#dfdff2'
  16         [color0]='#3e4755'     [color8]='#5d6473'
  17         [color1]='#e28479'     [color9]='#ec8e83'
  18         [color2]='#70b791'    [color10]='#7ac19b'
  19         [color3]='#c9c76b'    [color11]='#d3d175'
  20         [color4]='#839aec'    [color12]='#8da4f6'
  21         [color5]='#d18493'    [color13]='#db8e9d'
  22         [color6]='#78b3c5'    [color14]='#82bdcf'
  23         [color7]='#d2d2d4'    [color15]='#d1d1d3'
  24 ) # }}}
  25 declare -A ci_dark=( # {{{
  26     [background]='#24292e' [foreground]='#f6f8fa'
  27         [color0]='#24292e'     [color8]='#3a3f43'
  28         [color1]='#f97583'     [color9]='#f97583'
  29         [color2]='#85e89d'    [color10]='#85e89d'
  30         [color3]='#ffea7f'    [color11]='#ffea7f'
  31         [color4]='#79b8ff'    [color12]='#79b8ff'
  32         [color5]='#b392f0'    [color13]='#b392f0'
  33         [color6]='#73e3ff'    [color14]='#73e3ff'
  34         [color7]='#959da5'    [color15]='#f6f8fa'
  35 ) # }}}
  36 declare -A default=( # {{{
  37     [background]='#222228' [foreground]='#d8dade'
  38         [color0]='#222228'     [color8]='#4e4e56' # [color8]='#37373f'
  39         [color1]='#ff5f5f'     [color9]='#ff5f5f'
  40         [color2]='#87af5f'    [color10]='#87af5f'
  41         [color3]='#d7af87'    [color11]='#d7af87' # [color11]='#ffd75f'
  42         [color4]='#5f5fff'    [color12]='#afafd7'
  43         [color5]='#d75fff'    [color13]='#d75fff'
  44         [color6]='#87d7d7'    [color14]='#87d7d6'
  45         [color7]='#a8aaae'    [color15]='#d8dade'
  46 ) # }}}
  47 declare -A default_base16=( # {{{
  48     [background]='#181818' [foreground]='#d8d8d8'
  49         [color0]='#181818'     [color8]='#585858'
  50         [color1]='#ab4642'     [color9]='#ab4642'
  51         [color2]='#a1b56c'    [color10]='#a1b56c'
  52         [color3]='#f7ca88'    [color11]='#f7ca88'
  53         [color4]='#7cafc2'    [color12]='#7cafc2'
  54         [color5]='#ba8baf'    [color13]='#ba8baf'
  55         [color6]='#86c1b9'    [color14]='#86c1b9'
  56         [color7]='#d8d8d8'    [color15]='#f8f8f8'
  57 ) # }}}
  58 declare -A dkeg_prevail=( # {{{
  59     [background]='#263139' [foreground]='#ffffff' # [foreground]='#dac99d'
  60         [color0]='#263139'     [color8]='#455867'
  61         [color1]='#f36f62'     [color9]='#f36f62'
  62         [color2]='#c5e19c'    [color10]='#c5e19c'
  63         [color3]='#ccb478'    [color11]='#ccb478'
  64         [color4]='#4c7e89'    [color12]='#4c7e89'
  65         [color5]='#814d61'    [color13]='#814d61'
  66         [color6]='#79a69d'    [color14]='#79a69d'
  67         [color7]='#c4c4b5'    [color15]='#dbdbd1'
  68 ) # }}}
  69 declare -A dkeg_simplicity=( # {{{
  70     [background]='#28282c' [foreground]='#a18673'
  71         [color0]='#28282c'     [color8]='#404047'
  72         [color1]='#bf5c56'     [color9]='#bf5c56'
  73         [color2]='#bf5c56'    [color10]='#bf5c56'
  74         [color3]='#97b19c'    [color11]='#97b19c'
  75         [color4]='#97b19c'    [color12]='#97b19c'
  76         [color5]='#d7bd8a'    [color13]='#d7bd8a'
  77         [color6]='#d7bd8a'    [color14]='#d7bd8a'
  78         [color7]='#f4f4f2'    [color15]='#f4f4f2' # [color7]='#545f72'
  79 ) # }}}
  80 declare -A dracula=( # {{{
  81     [background]='#282a36' [foreground]='#f8f8f2'
  82         [color0]='#000000'     [color8]='#4d4d4d'
  83         [color1]='#ff5555'     [color9]='#ff6e67'
  84         [color2]='#50fa7b'    [color10]='#5af78e'
  85         [color3]='#f1fa8c'    [color11]='#f4f99d'
  86         [color4]='#bd93f9'    [color12]='#caa9fa'
  87         [color5]='#ff79c6'    [color13]='#ff92d0'
  88         [color6]='#8be9fd'    [color14]='#9aedfe'
  89         [color7]='#bfbfbf'    [color15]='#e6e6e6'
  90 ) # }}}
  91 declare -A dracula_base16=( # {{{
  92     [background]='#282936' [foreground]='#e9e9f4'
  93         [color0]='#282936'     [color8]='#4d4f68'
  94         [color1]='#ea51b2'     [color9]='#ea51b2'
  95         [color2]='#00f769'    [color10]='#00f769'
  96         [color3]='#ebff87'    [color11]='#ebff87'
  97         [color4]='#62d6e8'    [color12]='#62d6e8'
  98         [color5]='#b45bcf'    [color13]='#b45bcf'
  99         [color6]='#a1efe4'    [color14]='#a1efe4'
 100         [color7]='#e9e9f4'    [color15]='#f7f7fb'
 101 ) # }}}
 102 declare -A eighties_base16=( # {{{
 103     [background]='#2d2d2d' [foreground]='#d3d0c8'
 104         [color0]='#2d2d2d'     [color8]='#747369'
 105         [color1]='#f2777a'     [color9]='#f2777a'
 106         [color2]='#99cc99'    [color10]='#99cc99'
 107         [color3]='#ffcc66'    [color11]='#ffcc66'
 108         [color4]='#6699cc'    [color12]='#6699cc'
 109         [color5]='#cc99cc'    [color13]='#cc99cc'
 110         [color6]='#66cccc'    [color14]='#66cccc'
 111         [color7]='#d3d0c8'    [color15]='#f2f0ec'
 112 ) # }}}
 113 declare -A flat_base16=( # {{{
 114     [background]='#2c3e50' [foreground]='#e0e0e0'
 115         [color0]='#2c3e50'     [color8]='#95a5a6'
 116         [color1]='#e74c3c'     [color9]='#e74c3c'
 117         [color2]='#2ecc71'    [color10]='#2ecc71'
 118         [color3]='#f1c40f'    [color11]='#f1c40f'
 119         [color4]='#3498db'    [color12]='#3498db'
 120         [color5]='#9b59b6'    [color13]='#9b59b6'
 121         [color6]='#1abc9c'    [color14]='#1abc9c'
 122         [color7]='#e0e0e0'    [color15]='#ecf0f1'
 123 ) # }}}
 124 declare -A gruvbox_hard_base16=( # {{{
 125     [background]='#1d2021' [foreground]='#d5c4a1'
 126         [color0]='#1d2021'     [color8]='#665c54'
 127         [color1]='#fb4934'     [color9]='#fb4934'
 128         [color2]='#b8bb26'    [color10]='#b8bb26'
 129         [color3]='#fabd2f'    [color11]='#fabd2f'
 130         [color4]='#83a598'    [color12]='#83a598'
 131         [color5]='#d3869b'    [color13]='#d3869b'
 132         [color6]='#8ec07c'    [color14]='#8ec07c'
 133         [color7]='#d5c4a1'    [color15]='#fbf1c7'
 134 ) # }}}
 135 declare -A gruvbox_medium_base16=( # {{{
 136     [background]='#282828' [foreground]='#d5c4a1'
 137         [color0]='#282828'     [color8]='#665c54'
 138         [color1]='#fb4934'     [color9]='#fb4934'
 139         [color2]='#b8bb26'    [color10]='#b8bb26'
 140         [color3]='#fabd2f'    [color11]='#fabd2f'
 141         [color4]='#83a598'    [color12]='#83a598'
 142         [color5]='#d3869b'    [color13]='#d3869b'
 143         [color6]='#8ec07c'    [color14]='#8ec07c'
 144         [color7]='#d5c4a1'    [color15]='#fbf1c7'
 145 ) # }}}
 146 declare -A gruvbox_pale_base16=( # {{{
 147     [background]='#262626' [foreground]='#dab997'
 148         [color0]='#262626'     [color8]='#8a8a8a'
 149         [color1]='#d75f5f'     [color9]='#d75f5f'
 150         [color2]='#afaf00'    [color10]='#afaf00'
 151         [color3]='#ffaf00'    [color11]='#ffaf00'
 152         [color4]='#83adad'    [color12]='#83adad'
 153         [color5]='#d485ad'    [color13]='#d485ad'
 154         [color6]='#85ad85'    [color14]='#85ad85'
 155         [color7]='#dab997'    [color15]='#ebdbb2'
 156 ) # }}}
 157 declare -A gruvbox_soft_base16=( # {{{
 158     [background]='#32302f' [foreground]='#d5c4a1'
 159         [color0]='#32302f'     [color8]='#665c54'
 160         [color1]='#fb4934'     [color9]='#fb4934'
 161         [color2]='#b8bb26'    [color10]='#b8bb26'
 162         [color3]='#fabd2f'    [color11]='#fabd2f'
 163         [color4]='#83a598'    [color12]='#83a598'
 164         [color5]='#d3869b'    [color13]='#d3869b'
 165         [color6]='#8ec07c'    [color14]='#8ec07c'
 166         [color7]='#d5c4a1'    [color15]='#fbf1c7'
 167 ) # }}}
 168 declare -A hybrid=( # {{{
 169     [foreground]='#c5c8c6' [background]='#1d1f21'
 170         [color0]='#282a2e'     [color8]='#373b41'
 171         [color1]='#cc6666'     [color9]='#cc6666'
 172         [color2]='#b5bd68'    [color10]='#b5bd68'
 173         [color3]='#f0c674'    [color11]='#f0c674'
 174         [color4]='#81a2be'    [color12]='#81a2be'
 175         [color5]='#b294bb'    [color13]='#b294bb'
 176         [color6]='#8abeb7'    [color14]='#8abeb7'
 177         [color7]='#c5c8c6'    [color15]='#c5c8c6'
 178 ) # }}}
 179 declare -A hybrid_material=( # {{{
 180     [background]='#263238' [foreground]='#ffffff'
 181         [color0]='#263238'     [color8]='#707880'
 182         [color1]='#cc6666'     [color9]='#cc6666'
 183         [color2]='#f0c674'    [color10]='#f0c674'
 184         [color3]='#b5bd68'    [color11]='#b5bd68'
 185         [color4]='#8abeb7'    [color12]='#8abeb7'
 186         [color5]='#81a2be'    [color13]='#81a2be'
 187         [color6]='#b294bb'    [color14]='#b294bb'
 188         [color7]='#ffffff'    [color15]='#ffffff'
 189 ) # }}}
 190 declare -A materia_base16=( # {{{
 191     [background]='#263238' [foreground]='#cdd3de'
 192         [color0]='#263238'     [color8]='#707880'
 193         [color1]='#ec5f67'     [color9]='#ec5f67'
 194         [color2]='#8bd649'    [color10]='#8bd649'
 195         [color3]='#ffcc00'    [color11]='#ffcc00'
 196         [color4]='#89ddff'    [color12]='#89ddff'
 197         [color5]='#82aaff'    [color13]='#82aaff'
 198         [color6]='#80cbc4'    [color14]='#80cbc4'
 199         [color7]='#cdd3de'    [color15]='#ffffff'
 200 ) # }}}
 201 declare -A material_base16=( # {{{
 202     [background]='#263238' [foreground]='#eeffff'
 203         [color0]='#263238'     [color8]='#546e7a'
 204         [color1]='#f07178'     [color9]='#f07178'
 205         [color2]='#c3e88d'    [color10]='#c3e88d'
 206         [color3]='#ffcb6b'    [color11]='#ffcb6b'
 207         [color4]='#82aaff'    [color12]='#82aaff'
 208         [color5]='#c792ea'    [color13]='#c792ea'
 209         [color6]='#89ddff'    [color14]='#89ddff'
 210         [color7]='#eeffff'    [color15]='#ffffff'
 211 ) # }}}
 212 declare -A material_palenight_base16=( # {{{
 213     [background]='#292d3e' [foreground]='#959dcb'
 214         [color0]='#292d3e'     [color8]='#676e95'
 215         [color1]='#f07178'     [color9]='#f07178'
 216         [color2]='#c3e88d'    [color10]='#c3e88d'
 217         [color3]='#ffcb6b'    [color11]='#ffcb6b'
 218         [color4]='#82aaff'    [color12]='#82aaff'
 219         [color5]='#c792ea'    [color13]='#c792ea'
 220         [color6]='#89ddff'    [color14]='#89ddff'
 221         [color7]='#959dcb'    [color15]='#ffffff'
 222 ) # }}}
 223 declare -A materialer_base16=( # {{{
 224     [background]='#212121' [foreground]='#eeffff'
 225         [color0]='#212121'     [color8]='#4a4a4a'
 226         [color1]='#f07178'     [color9]='#f07178'
 227         [color2]='#c3e88d'    [color10]='#c3e88d'
 228         [color3]='#ffcb6b'    [color11]='#ffcb6b'
 229         [color4]='#82aaff'    [color12]='#82aaff'
 230         [color5]='#c792ea'    [color13]='#c792ea'
 231         [color6]='#89ddff'    [color14]='#89ddff'
 232         [color7]='#eeffff'    [color15]='#ffffff'
 233 ) # }}}
 234 declare -A mocha_base16=( # {{{
 235     [background]='#3b3228' [foreground]='#d0c8c6'
 236         [color0]='#3b3228'     [color8]='#7e705a'
 237         [color1]='#cb6077'     [color9]='#cb6077'
 238         [color2]='#beb55b'    [color10]='#beb55b'
 239         [color3]='#f4bc87'    [color11]='#f4bc87'
 240         [color4]='#8ab3b5'    [color12]='#8ab3b5'
 241         [color5]='#a89bb9'    [color13]='#a89bb9'
 242         [color6]='#7bbda4'    [color14]='#7bbda4'
 243         [color7]='#d0c8c6'    [color15]='#f5eeeb'
 244 ) # }}}
 245 declare -A monokai=( # {{{
 246     [background]='#272822' [foreground]='#f8f8f2'
 247         [color0]='#272822'     [color8]='#75715e'
 248         [color1]='#f92672'     [color9]='#f92672'
 249         [color2]='#a6e22e'    [color10]='#a6e22e'
 250         [color3]='#f4bf75'    [color11]='#f4bf75'
 251         [color4]='#66d9ef'    [color12]='#66d9ef'
 252         [color5]='#ae81ff'    [color13]='#ae81ff'
 253         [color6]='#a1efe4'    [color14]='#a1efe4'
 254         [color7]='#f8f8f2'    [color15]='#f8f8f2'
 255 ) # }}}
 256 declare -A muzieca_lowcontrast=( # {{{
 257     [background]='#3c3b37' [foreground]='#93a1a1'
 258         [color0]='#5f5f5f'     [color8]='#828282'
 259         [color1]='#d96468'     [color9]='#d98f93'
 260         [color2]='#b8d98f'    [color10]='#b8d98f'
 261         [color3]='#d9cf8f'    [color11]='#d9cf8f'
 262         [color4]='#8f99d9'    [color12]='#8f99d9'
 263         [color5]='#b08fd9'    [color13]='#b08fd9'
 264         [color6]='#8fd9d5'    [color14]='#8fd9d5'
 265         [color7]='#c5c5c5'    [color15]='#ffffff'
 266 ) # }}}
 267 declare -A nord=( # {{{
 268     [background]='#2e3440' [foreground]='#d8dee9'
 269         [color0]='#3b4252'     [color8]='#4c566a'
 270         [color1]='#bf616a'     [color9]='#bf616a'
 271         [color2]='#a3be8c'    [color10]='#a3be8c'
 272         [color3]='#ebcb8b'    [color11]='#ebcb8b'
 273         [color4]='#81a1c1'    [color12]='#81a1c1'
 274         [color5]='#b48ead'    [color13]='#b48ead'
 275         [color6]='#88c0d0'    [color14]='#8fbcbb'
 276         [color7]='#e5e9f0'    [color15]='#eceff4'
 277 ) # }}}
 278 declare -A nord_base16=( # {{{
 279     [background]='#2e3440' [foreground]='#e5e9f0'
 280         [color0]='#2e3440'     [color8]='#4c566a'
 281         [color1]='#88c0d0'     [color9]='#88c0d0'
 282         [color2]='#bf616a'    [color10]='#bf616a'
 283         [color3]='#5e81ac'    [color11]='#5e81ac'
 284         [color4]='#ebcb8b'    [color12]='#ebcb8b'
 285         [color5]='#a3be8c'    [color13]='#a3be8c'
 286         [color6]='#d08770'    [color14]='#d08770'
 287         [color7]='#e5e9f0'    [color15]='#8fbcbb'
 288 ) # }}}
 289 declare -A ocean_base16=( # {{{
 290     [background]='#2b303b' [foreground]='#c0c5ce'
 291         [color0]='#2b303b'     [color8]='#65737e'
 292         [color1]='#bf616a'     [color9]='#bf616a'
 293         [color2]='#a3be8c'    [color10]='#a3be8c'
 294         [color3]='#ebcb8b'    [color11]='#ebcb8b'
 295         [color4]='#8fa1b3'    [color12]='#8fa1b3'
 296         [color5]='#b48ead'    [color13]='#b48ead'
 297         [color6]='#96b5b4'    [color14]='#96b5b4'
 298         [color7]='#c0c5ce'    [color15]='#eff1f5'
 299 ) # }}}
 300 declare -A oceanicnext_base16=( # {{{
 301     [background]='#1b2b34' [foreground]='#c0c5ce'
 302         [color0]='#1b2b34'     [color8]='#65737e'
 303         [color1]='#ec5f67'     [color9]='#ec5f67'
 304         [color2]='#99c794'    [color10]='#99c794'
 305         [color3]='#fac863'    [color11]='#fac863'
 306         [color4]='#6699cc'    [color12]='#6699cc'
 307         [color5]='#c594c5'    [color13]='#c594c5'
 308         [color6]='#5fb3b3'    [color14]='#5fb3b3'
 309         [color7]='#c0c5ce'    [color15]='#d8dee9'
 310 ) # }}}
 311 declare -A porple_base16=( # {{{
 312     [background]='#292c36' [foreground]='#d8d8d8'
 313         [color0]='#292c36'     [color8]='#65568a'
 314         [color1]='#f84547'     [color9]='#f84547'
 315         [color2]='#95c76f'    [color10]='#95c76f'
 316         [color3]='#efa16b'    [color11]='#efa16b'
 317         [color4]='#8485ce'    [color12]='#8485ce'
 318         [color5]='#b74989'    [color13]='#b74989'
 319         [color6]='#64878f'    [color14]='#64878f'
 320         [color7]='#d8d8d8'    [color15]='#f8f8f8'
 321 ) # }}}
 322 declare -A rebecca_base16=( # {{{
 323     [background]='#292a44' [foreground]='#f1eff8'
 324         [color0]='#292a44'     [color8]='#666699'
 325         [color1]='#a0a0c5'     [color9]='#a0a0c5'
 326         [color2]='#6dfedf'    [color10]='#6dfedf'
 327         [color3]='#ae81ff'    [color11]='#ae81ff'
 328         [color4]='#2de0a7'    [color12]='#2de0a7'
 329         [color5]='#7aa5ff'    [color13]='#7aa5ff'
 330         [color6]='#8eaee0'    [color14]='#8eaee0'
 331         [color7]='#f1eff8'    [color15]='#53495d'
 332 ) # }}}
 333 declare -A solarized=( # {{{
 334     [background]='#073642' [foreground]='#fdf6e3'
 335         [color0]='#073642'     [color8]='#6c7c80'
 336         [color1]='#dc322f'     [color9]='#dc322f'
 337         [color2]='#859900'    [color10]='#859900'
 338         [color3]='#b58900'    [color11]='#b58900'
 339         [color4]='#268bd2'    [color12]='#268bd2'
 340         [color5]='#d33682'    [color13]='#d33682'
 341         [color6]='#2aa198'    [color14]='#2aa198'
 342         [color7]='#eee8d5'    [color15]='#eee8d5'
 343 ) # }}}
 344 declare -A tomorrow_night_base16=( # {{{
 345     [background]='#1d1f21' [foreground]='#c5c8c6'
 346         [color0]='#1d1f21'     [color8]='#969896'
 347         [color1]='#cc6666'     [color9]='#cc6666'
 348         [color2]='#b5bd68'    [color10]='#b5bd68'
 349         [color3]='#f0c674'    [color11]='#f0c674'
 350         [color4]='#81a2be'    [color12]='#81a2be'
 351         [color5]='#b294bb'    [color13]='#b294bb'
 352         [color6]='#8abeb7'    [color14]='#8abeb7'
 353         [color7]='#c5c8c6'    [color15]='#ffffff'
 354 ) # }}}
 355 declare -A zenburn3=( # {{{
 356     [background]='#3f3f3f' [foreground]='#ffffff'
 357         [color0]='#3f3f3f'     [color8]='#828282'
 358         [color1]='#dca5a5'     [color9]='#dca5a5'
 359         [color2]='#c0e380'    [color10]='#c0e380'
 360         [color3]='#e4e49a'    [color11]='#e4e49a'
 361         [color4]='#7d9ec0'    [color12]='#7d9ec0'
 362         [color5]='#ffc66d'    [color13]='#ffc66d'
 363         [color6]='#8acccf'    [color14]='#8acccf'
 364         [color7]='#ffffff'    [color15]='#ffffff'
 365 ) # }}}
 366 
 367 return 2>&-
 368 
 369 declare -n colors=default
 370 declare -A gtk=( # {{{
 371     [Adapta-Amber]=yellow
 372     [Adapta-Blue]=blue
 373     [Adapta-BlueGrey]=bluegrey
 374     [Adapta-Brown]=brown
 375     [Adapta-Cyan]=cyan
 376     [Adapta-DeepOrange]=deeporange
 377     [Adapta-DeepPurple]=violet
 378     [Adapta-Green]=green
 379     [Adapta-Grey]=grey
 380     [Adapta-Indigo]=indigo
 381     [Adapta-LightBlue]=breeze
 382     [Adapta-Lime]=paleorange
 383     [Adapta-Orange]=orange
 384     [Adapta-Pink]=pink
 385     [Adapta-Purple]=magenta
 386     [Adapta-Red]=red
 387     [Adapta-Teal]=teal
 388     [Mint-Aqua]=breeze
 389     [Mint-Blue]=blue
 390     [Mint-Brown]=brown
 391     [Mint-Green]=green
 392     [Mint-Grey]=grey
 393     [Mint-Orange]=orange
 394     [Mint-Pink]=pink
 395     [Mint-Purple]=violet
 396     [Mint-Red]=red
 397     [Mint-Sand]=palebrown
 398     [Mint-Teal]=teal
 399     [Nordic]=nordic
 400     [Nordic-White]=nordic
 401     [Dracula]=violet
 402     [Mojave]=yaru
 403 ) # }}}
 404 
 405 source ~/.theme/colors.sh 2>&- &&
 406 for i in {back,fore}ground color{0..15}; do colors[$i]=${!i}; done
 407 
 408 ################################################################################
 409 
 410 xset(){ # {{{
 411     xfconf-query -c $1 -p $2 -s $3
 412 } # }}}
 413 gset(){ # {{{
 414     gsettings list-recursively | grep "$1" |
 415     while read a b c; do gsettings set $a $b $2; done
 416 } # }}}
 417 
 418 case $1 in
 419     -r|--reload) reload=1;;
 420 
 421     -b|--background)
 422         cp "$2" ~/.theme/background.jpg
 423         hsetroot -solid ${colors[background]} -fill $_
 424 
 425         gset picture-filename   $_
 426         gset picture-uri file://$_
 427 
 428         qdbus --system org.freedesktop.Accounts /org/freedesktop/Accounts/User$UID \
 429         org.freedesktop.DisplayManager.AccountsService.BackgroundFile $_
 430 
 431         exit
 432     ;;
 433 
 434     -c|--colors)
 435         reload=1
 436         source $0 && declare -n colors=${2:-null}
 437         c(){ source $0; local | grep -o '^\w*'; }
 438         [[ ! $2 || ! ${colors[@]} ]] && c && exit
 439     ;;
 440 
 441     -w|--wal)
 442         [[ -f $2 ]] && wal -qnstei "$2" && $0 -b "$2" || wal -qnste --theme "${@:2}"
 443         [[    $2 ]] && cp ~/.cache/wal/colors.sh ~/.theme/ && $0 -r
 444         exit
 445     ;;
 446 
 447     -g|--gtk)
 448         decor=$2 theme=$2 icons=ePapirus
 449 
 450         [[ ! $2 || ! ${gtk[$2]} ]] && printf '%s\n' ${!gtk[@]} | sort && exit
 451         [[ $theme == Mint-*     ]] && theme=Mint-Y-${2#Mint-} icons=$theme
 452         [[ $icons == ePapirus   ]] && papirus-folders -C ${gtk[$2]} > /dev/null
 453 
 454         decor=${decor/Mint-Y/Mint-Y-Dark}
 455         theme=${theme/Adapta-Cyan/Adapta}
 456         theme=${theme/Mint-Y-Green/Mint-Y}
 457         theme=${theme/Dracula/Adapta-DeepPurple}
 458 
 459         decor=${decor/Nordic-White/Arc-Dark}
 460         theme=${theme/Nordic-White/Adapta-BlueGrey}
 461 
 462         decor=${decor/Nordic/Nordic-Polar}
 463         theme=${theme/Nordic/Nordic-Polar}
 464 
 465         decor=${decor/Mojave/Mojave-dark}
 466         theme=${theme/Mojave/Mojave-light}
 467 
 468         xset xsettings /Net/IconThemeName reset
 469         xset xsettings /Net/ThemeName     $theme
 470         xset xsettings /Net/IconThemeName $icons
 471         xset xfwm4     /general/theme     $decor
 472 
 473         gset gtk-theme  $theme
 474         gset icon-theme $icons
 475         gset ' theme '  $decor
 476 
 477         exit
 478     ;;
 479 
 480     -C|--rand-colors    ) $0 -c $($0 -c | shuf -n 1); exit;;
 481     -G|--rand-gtk       ) $0 -g $($0 -g | shuf -n 1); exit;;
 482     -B|--rand-background) $0 -b $(find ~/Wallpapers | shuf -n 1); exit;;
 483     -W|--rand-wal       ) $0 -w $($0 -w | grep '^\s-' | cut -b 4- | shuf -n 1); exit;;
 484 esac
 485 
 486 mkdir -p ~/.theme && cd $_
 487 
 488 ################################################################################
 489 
 490 print(){ # {{{
 491     printf "${2:-%s}\n" "$(for i in ${!colors[@]}; do printf "$1\n" $i "${colors[$i]}"; done)"
 492 } # }}}
 493 rgba(){ # {{{
 494     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 ))
 495 } # }}}
 496 
 497 [[ ${colors[foreground]} < ${colors[color7]}  ]] && colors[foreground]=${colors[color7]}
 498 [[ ${colors[foreground]} < ${colors[color15]} ]] && colors[foreground]=${colors[color15]}
 499 
 500 colors[background_rgba]=${colors[background]}e0
 501 colors[background_argb]=${colors[background]/\#/\#e0}
 502 
 503 > colors.xres print '*%s: %s'
 504 > colors.lua  print '%s = "%s";'
 505 > colors.vim  print 'let %s = "%s"'
 506 > colors.sh   print 'export %s="%s"'
 507 > colors.h    print 'char %s[] = "%s";'
 508 > colors.ini  print '%s = %s' '[colors]\n%s'
 509 
 510 colors[background-rgba]=$(rgba ${colors[background_rgba]})
 511 unset colors[background_rgba] colors[background_argb]
 512 
 513 > colors.gtk  print '@define-color %s %s;'
 514 > colors.rasi print '  %s: %s;' '* {\n%s\n}'
 515 > colors.css  print '  --%s: %s;' ':root {\n%s\n}'
 516 
 517 > colors-xterm printf '\e]%s;%s\a' \
 518 10 ${colors[foreground]}      11 ${colors[background]} \
 519 12 ${colors[foreground]} '4;256' ${colors[foreground]} \
 520 $(for i in {0..15}; do echo "4;$i" ${colors[color$i]}; done)
 521 
 522 colors[color7]=${colors[foreground]}
 523 > colors-linux printf '\e]P%x%s\a' $(for i in {0..7}; do echo $i ${colors[color$i]:1}; done)
 524 
 525 ################################################################################
 526 
 527 printf '\e[1;30m'
 528 trap 'printf "\e[0m"; colors' EXIT
 529 
 530 source colors.sh
 531 
 532 xrdb -merge colors.xres
 533 xrdb -merge ~/.config/xorg.conf
 534 
 535 $0   -b background.jpg  &
 536 test -f background.jpg || filvice &
 537 
 538 find ~/.config ~/.local -name \*.theme |
 539 while read i; do envsubst < $i > ${i%.theme}; done
 540 
 541 [[ $reload ]] || exit
 542 
 543 cmp -s background.jpg ~/.cache/filvice.png && filvice -r &
 544 
 545 for i in /dev/pts/[0-9]; do cat colors-xterm > $i; done
 546 for i in /dev/tty[0-9];  do cat colors-linux > $i; done 2>&-
 547 
 548 vim --serverlist | xargs -I % vim --servername % --remote-send '<Esc>:so $MYGVIMRC<Cr>'
 549 
 550 i3 restart
 551 killall dunst
 552 
 553 killall -HUP  dwm awesome xfwm4
 554 killall -USR1 openbox; sleep 0.5
 555 killall -USR1 sxhkd polybar xfce4-panel