├── README.md └── src ├── col2mid ├── col2pal ├── col2prv ├── col2sort ├── col2sys ├── col2term ├── col2thm ├── col2upd ├── dir2thm ├── font2sys ├── img2col ├── img2thm ├── img2wal ├── rnd2wal ├── thm2surf ├── thm2sys ├── web2wal ├── xres2col ├── xres2thm └── xres2var /README.md: -------------------------------------------------------------------------------- 1 | # wp-themes 2 | 3 | ## Requirements 4 | - Bash 5 | - Imagemagick 6 | - GAWK 7 | 8 | ## Optional 9 | - Feh (for wallpaper) [img2wal] 10 | - Python (for gtk theme changing) 11 | 12 | ## Scripts 13 | - col2pal: Convert color list to a palette file, sorting colors by brightness (darkest to brightest) 14 | - col2prv: Convert color list to a preview file, displaying each color in a square 15 | - col2sys: Reload system programs to use new colors (you may need to edit this one) 16 | - col2thm: Generate a color theme (termcolors, xresources, gtk) based on a color list 17 | - dir2thm: Generate a color scheme for all files of a specific folder 18 | - img2col: Extract 16 dominant colors out from a specific image 19 | - img2thm: Generate a color theme (termcolors, xresources, gtk) based on an image 20 | - img2wal: Set a specific image to the background wallpaper, using feh 21 | - web2wal: Script will automatically figure out primary screen resolution and download a wallpaper of a specific type from wallpaperscraft.com, randomly chosen. 22 | 23 | ## Notes 24 | - GTK color theme is not finished and not supposed to work as of yet 25 | - GTK icon theme is not started yet -------------------------------------------------------------------------------- /src/col2mid: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Color to middle: Extracts 8 not too light and dark colors from 16 4 | col2sort | tail -n +6 | head -n 8 -------------------------------------------------------------------------------- /src/col2pal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function main(){ 4 | 5 | while read colorLine; do 6 | echo -n "${colorLine}" 7 | done >> "${1:-palette.txt}" 8 | } 9 | 10 | main "${1}" -------------------------------------------------------------------------------- /src/col2prv: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Colors to preview: Save colors into preview file 4 | while read color; do 5 | convert -size 20x20 "xc:$color" +depth miff:- 6 | done | montage - -geometry +0+0 "${1:-preview.png}" < "/dev/stdin" -------------------------------------------------------------------------------- /src/col2sort: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function get_value(){ 4 | local hexinput=`echo $1 | tr -d '#' | tr '[:lower:]' '[:upper:]'` #uppercaseing 5 | 6 | local a=`echo $hexinput | cut -c-2` 7 | local b=`echo $hexinput | cut -c3-4` 8 | local c=`echo $hexinput | cut -c5-6` 9 | 10 | local r=`echo "ibase=16; $a" | bc` 11 | local g=`echo "ibase=16; $b" | bc` 12 | local b=`echo "ibase=16; $c" | bc` 13 | 14 | echo "$((${r} + ${g} + ${b}))" 15 | } 16 | 17 | function main(){ 18 | local colorList='' 19 | local colorValue=0 20 | 21 | while read curColor; do 22 | colorValue=$(get_value "${curColor}") 23 | colorList+="${colorValue};${curColor}\n" 24 | done 25 | 26 | colorList=$(echo -e "${colorList}" | sort -n -t ';') 27 | 28 | echo "${colorList}" | while read colorLine; do 29 | echo -n "${colorLine}" | awk -F ';' '{print $2}' 30 | done 31 | } 32 | 33 | main -------------------------------------------------------------------------------- /src/col2sys: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Requires package pygtk 4 | function reload_gtk(){ 5 | python2 - < "${1:-$PWD}/Xresources" 32 | echo "" >> "${1:-$PWD}/Xresources" 33 | 34 | echo "#define base00 ${themeColors[0]}" >> "${1:-$PWD}/Xresources" 35 | echo "#define base01 ${themeColors[1]}" >> "${1:-$PWD}/Xresources" 36 | echo "#define base02 ${themeColors[2]}" >> "${1:-$PWD}/Xresources" 37 | echo "#define base03 ${themeColors[3]}" >> "${1:-$PWD}/Xresources" 38 | echo "#define base04 ${themeColors[4]}" >> "${1:-$PWD}/Xresources" 39 | echo "#define base05 ${themeColors[5]}" >> "${1:-$PWD}/Xresources" 40 | echo "#define base06 ${themeColors[6]}" >> "${1:-$PWD}/Xresources" 41 | echo "#define base07 ${themeColors[7]}" >> "${1:-$PWD}/Xresources" 42 | echo "#define base08 ${themeColors[8]}" >> "${1:-$PWD}/Xresources" 43 | echo "#define base09 ${themeColors[9]}" >> "${1:-$PWD}/Xresources" 44 | echo "#define base0A ${themeColors[10]}" >> "${1:-$PWD}/Xresources" 45 | echo "#define base0B ${themeColors[11]}" >> "${1:-$PWD}/Xresources" 46 | echo "#define base0C ${themeColors[12]}" >> "${1:-$PWD}/Xresources" 47 | echo "#define base0D ${themeColors[13]}" >> "${1:-$PWD}/Xresources" 48 | echo "#define base0E ${themeColors[14]}" >> "${1:-$PWD}/Xresources" 49 | echo "#define base0F ${themeColors[15]}" >> "${1:-$PWD}/Xresources" 50 | echo "" >> "${1:-$PWD}/Xresources" 51 | 52 | echo "*.foreground: base0F" >> "${1:-$PWD}/Xresources" # base05 53 | echo "*.background: base00" >> "${1:-$PWD}/Xresources" # base00 54 | echo "*.cursorColor: base0F" >> "${1:-$PWD}/Xresources" # base05 55 | echo "" >> "${1:-$PWD}/Xresources" 56 | 57 | echo "*.color0: base00" >> "${1:-$PWD}/Xresources" 58 | echo "*.color1: base08" >> "${1:-$PWD}/Xresources" 59 | echo "*.color2: base0B" >> "${1:-$PWD}/Xresources" 60 | echo "*.color3: base0A" >> "${1:-$PWD}/Xresources" 61 | echo "*.color4: base0D" >> "${1:-$PWD}/Xresources" 62 | echo "*.color5: base0E" >> "${1:-$PWD}/Xresources" 63 | echo "*.color6: base0C" >> "${1:-$PWD}/Xresources" 64 | echo "*.color7: base05" >> "${1:-$PWD}/Xresources" 65 | echo "*.color8: base03" >> "${1:-$PWD}/Xresources" 66 | echo "*.color9: base09" >> "${1:-$PWD}/Xresources" 67 | echo "*.color10: base01" >> "${1:-$PWD}/Xresources" 68 | echo "*.color11: base02" >> "${1:-$PWD}/Xresources" 69 | echo "*.color12: base04" >> "${1:-$PWD}/Xresources" 70 | echo "*.color13: base06" >> "${1:-$PWD}/Xresources" 71 | echo "*.color14: base0F" >> "${1:-$PWD}/Xresources" 72 | echo "*.color15: base07" >> "${1:-$PWD}/Xresources" 73 | echo "" >> "${1:-$PWD}/Xresources" 74 | 75 | #echo "! Additional Colors" >> "${1:-$PWD}/Xresources" 76 | #echo "*.color16: base09" >> "${1:-$PWD}/Xresources" 77 | #echo "*.color17: base0F" >> "${1:-$PWD}/Xresources" 78 | #echo "*.color18: base01" >> "${1:-$PWD}/Xresources" 79 | #echo "*.color19: base02" >> "${1:-$PWD}/Xresources" 80 | #echo "*.color20: base04" >> "${1:-$PWD}/Xresources" 81 | #echo "*.color21: base06" >> "${1:-$PWD}/Xresources" 82 | #echo "" >> "${1:-$PWD}/Xresources" 83 | 84 | #echo "Xft.autohint: 0" >> "${1:-$PWD}/Xresources" 85 | #echo "Xft.lcdfilter: lcddefault" >> "${1:-$PWD}/Xresources" 86 | #echo "Xft.hinting: 1" >> "${1:-$PWD}/Xresources" 87 | #echo "Xft.hintstyle: hintslight" >> "${1:-$PWD}/Xresources" 88 | #echo "Xft.antialias: 1" >> "${1:-$PWD}/Xresources" 89 | #echo "Xft.rgba: rgb" >> "${1:-$PWD}/Xresources" 90 | #echo "" >> "${1:-$PWD}/Xresources" 91 | 92 | #echo '#include ".config/rofi/rofirc"' >> "${1:-$PWD}/Xresources" 93 | echo '#include ".config/font/fontrc"' >> "${1:-$PWD}/Xresources" 94 | echo '#include ".config/dmenu/dmenurc"' >> "${1:-$PWD}/Xresources" 95 | } 96 | 97 | function create_term(){ 98 | #readarray themeColors < "${COLOR_PALETTE}" 99 | 100 | echo "#!/usr/bin/env bash" > "${1:-$PWD}/termcolors" 101 | 102 | echo "color00=\"$(hex_to_term ${themeColors[0]})\"" >> "${1:-$PWD}/termcolors" 103 | echo "color01=\"$(hex_to_term ${themeColors[8]})\"" >> "${1:-$PWD}/termcolors" 104 | echo "color02=\"$(hex_to_term ${themeColors[11]})\"" >> "${1:-$PWD}/termcolors" 105 | echo "color03=\"$(hex_to_term ${themeColors[10]})\"" >> "${1:-$PWD}/termcolors" 106 | echo "color04=\"$(hex_to_term ${themeColors[13]})\"" >> "${1:-$PWD}/termcolors" 107 | echo "color05=\"$(hex_to_term ${themeColors[15]})\"" >> "${1:-$PWD}/termcolors" 108 | echo "color06=\"$(hex_to_term ${themeColors[12]})\"" >> "${1:-$PWD}/termcolors" 109 | echo "color07=\"$(hex_to_term ${themeColors[5]})\"" >> "${1:-$PWD}/termcolors" 110 | echo "color08=\"$(hex_to_term ${themeColors[3]})\"" >> "${1:-$PWD}/termcolors" 111 | echo "color09=\"$(hex_to_term ${themeColors[8]})\"" >> "${1:-$PWD}/termcolors" 112 | echo "color10=\"$(hex_to_term ${themeColors[11]})\"" >> "${1:-$PWD}/termcolors" 113 | echo "color11=\"$(hex_to_term ${themeColors[10]})\"" >> "${1:-$PWD}/termcolors" 114 | echo "color12=\"$(hex_to_term ${themeColors[13]})\"" >> "${1:-$PWD}/termcolors" 115 | echo "color13=\"$(hex_to_term ${themeColors[15]})\"" >> "${1:-$PWD}/termcolors" 116 | echo "color14=\"$(hex_to_term ${themeColors[12]})\"" >> "${1:-$PWD}/termcolors" 117 | echo "color15=\"$(hex_to_term ${themeColors[7]})\"" >> "${1:-$PWD}/termcolors" 118 | #echo "color16=\"$(hex_to_term ${themeColors[9]})\"" >> "${1:-$PWD}/termcolors" 119 | #echo "color17=\"$(hex_to_term ${themeColors[15]})\"" >> "${1:-$PWD}/termcolors" 120 | #echo "color18=\"$(hex_to_term ${themeColors[1]})\"" >> "${1:-$PWD}/termcolors" 121 | #echo "color19=\"$(hex_to_term ${themeColors[2]})\"" >> "${1:-$PWD}/termcolors" 122 | #echo "color20=\"$(hex_to_term ${themeColors[4]})\"" >> "${1:-$PWD}/termcolors" 123 | #echo "color21=\"$(hex_to_term ${themeColors[6]})\"" >> "${1:-$PWD}/termcolors" 124 | 125 | echo "color_foreground=\"$(hex_to_term ${themeColors[15]})\"" >> "${1:-$PWD}/termcolors" # 7 126 | echo "color_background=\"$(hex_to_term ${themeColors[0]})\"" >> "${1:-$PWD}/termcolors" # 1 127 | echo "color_cursor=\"$(hex_to_term ${themeColors[15]})\"" >> "${1:-$PWD}/termcolors" # 7 128 | 129 | echo 'printf_template="\033]4;%d;rgb:%s\033\\"' >> "${1:-$PWD}/termcolors" 130 | echo 'printf_template_var="\033]%d;rgb:%s\033\\"' >> "${1:-$PWD}/termcolors" 131 | echo 'printf_template_custom="\033]%s%s\033\\"' >> "${1:-$PWD}/termcolors" 132 | 133 | echo 'printf $printf_template 0 $color00' >> "${1:-$PWD}/termcolors" 134 | echo 'printf $printf_template 1 $color01' >> "${1:-$PWD}/termcolors" 135 | echo 'printf $printf_template 2 $color02' >> "${1:-$PWD}/termcolors" 136 | echo 'printf $printf_template 3 $color03' >> "${1:-$PWD}/termcolors" 137 | echo 'printf $printf_template 4 $color04' >> "${1:-$PWD}/termcolors" 138 | echo 'printf $printf_template 5 $color05' >> "${1:-$PWD}/termcolors" 139 | echo 'printf $printf_template 6 $color06' >> "${1:-$PWD}/termcolors" 140 | echo 'printf $printf_template 7 $color07' >> "${1:-$PWD}/termcolors" 141 | echo 'printf $printf_template 8 $color08' >> "${1:-$PWD}/termcolors" 142 | echo 'printf $printf_template 9 $color09' >> "${1:-$PWD}/termcolors" 143 | echo 'printf $printf_template 10 $color10' >> "${1:-$PWD}/termcolors" 144 | echo 'printf $printf_template 11 $color11' >> "${1:-$PWD}/termcolors" 145 | echo 'printf $printf_template 12 $color12' >> "${1:-$PWD}/termcolors" 146 | echo 'printf $printf_template 13 $color13' >> "${1:-$PWD}/termcolors" 147 | echo 'printf $printf_template 14 $color14' >> "${1:-$PWD}/termcolors" 148 | echo 'printf $printf_template 15 $color15' >> "${1:-$PWD}/termcolors" 149 | #echo 'printf $printf_template 16 $color16' >> "${1:-$PWD}/termcolors" 150 | #echo 'printf $printf_template 17 $color17' >> "${1:-$PWD}/termcolors" 151 | #echo 'printf $printf_template 18 $color18' >> "${1:-$PWD}/termcolors" 152 | #echo 'printf $printf_template 19 $color19' >> "${1:-$PWD}/termcolors" 153 | #echo 'printf $printf_template 20 $color20' >> "${1:-$PWD}/termcolors" 154 | #echo 'printf $printf_template 21 $color21' >> "${1:-$PWD}/termcolors" 155 | 156 | echo 'printf $printf_template_var 10 $color_foreground' >> "${1:-$PWD}/termcolors" 157 | echo 'printf $printf_template_var 11 $color_background' >> "${1:-$PWD}/termcolors" 158 | echo 'printf $printf_template_custom 12 ";7"' >> "${1:-$PWD}/termcolors" 159 | 160 | chmod +x "${1:-$PWD}/termcolors" 161 | } 162 | 163 | function create_gtk(){ 164 | # echo '@define-color bg_color '"${themeColors[0]}"';' > "${1:-$PWD}/gtk.css" 165 | # echo '@define-color fg_color '"${themeColors[15]}"';' >> "${1:-$PWD}/gtk.css" 166 | # echo '@define-color base_color '"${themeColors[14]}"';' >> "${1:-$PWD}/gtk.css" 167 | # echo '@define-color text_color '"${themeColors[2]}"';' >> "${1:-$PWD}/gtk.css" 168 | # echo '@define-color selected_bg_color '"${themeColors[5]}"';' >> "${1:-$PWD}/gtk.css" 169 | # echo '@define-color selected_fg_color '"${themeColors[13]}"';' >> "${1:-$PWD}/gtk.css" 170 | # echo '@define-color tooltip_bg_color '"${themeColors[1]}"';' >> "${1:-$PWD}/gtk.css" 171 | # echo '@define-color tooltip_fg_color '"${themeColors[3]}"';' >> "${1:-$PWD}/gtk.css" 172 | 173 | 174 | # echo '@define-color theme_bg_color @bg_color;' >> "${1:-$PWD}/gtk.css" 175 | # echo '@define-color theme_fg_color @fg_color;' >> "${1:-$PWD}/gtk.css" 176 | # echo '@define-color theme_base_color @base_color;' >> "${1:-$PWD}/gtk.css" 177 | # echo '@define-color theme_text_color @text_color;' >> "${1:-$PWD}/gtk.css" 178 | # echo '@define-color theme_selected_bg_color @selected_bg_color;' >> "${1:-$PWD}/gtk.css" 179 | # echo '@define-color theme_selected_fg_color @selected_fg_color;' >> "${1:-$PWD}/gtk.css" 180 | # echo '@define-color theme_tooltip_bg_color @tooltip_bg_color;' >> "${1:-$PWD}/gtk.css" 181 | # echo '@define-color theme_tooltip_fg_color @tooltip_fg_color;' >> "${1:-$PWD}/gtk.css" 182 | 183 | 184 | # echo '@define-color light_shadow '"${themeColors[15]}"';' >> "${1:-$PWD}/gtk.css" 185 | # echo '@define-color dark_shadow '"${themeColors[0]}"';' >> "${1:-$PWD}/gtk.css" 186 | 187 | 188 | # echo '@define-color info_fg_color '"${themeColors[7]}"';' >> "${1:-$PWD}/gtk.css" 189 | # echo '@define-color info_bg_color '"${themeColors[2]}"';' >> "${1:-$PWD}/gtk.css" 190 | # echo '@define-color warning_fg_color '"${themeColors[9]}"';' >> "${1:-$PWD}/gtk.css" 191 | # echo '@define-color warning_bg_color '"${themeColors[2]}"';' >> "${1:-$PWD}/gtk.css" 192 | # echo '@define-color question_fg_color '"${themeColors[11]}"';' >> "${1:-$PWD}/gtk.css" 193 | # echo '@define-color question_bg_color '"${themeColors[2]}"';' >> "${1:-$PWD}/gtk.css" 194 | # echo '@define-color error_fg_color '"${themeColors[5]}"';' >> "${1:-$PWD}/gtk.css" 195 | # echo '@define-color error_bg_color '"${themeColors[2]}"';' >> "${1:-$PWD}/gtk.css" 196 | # echo '@define-color link_color '"${themeColors[7]}"';' >> "${1:-$PWD}/gtk.css" 197 | # echo '@define-color success_color '"${themeColors[7]}"';' >> "${1:-$PWD}/gtk.css" 198 | # echo '@define-color warning_color '"${themeColors[9]}"';' >> "${1:-$PWD}/gtk.css" 199 | # echo '@define-color error_color '"${themeColors[5]}"';' >> "${1:-$PWD}/gtk.css" 200 | 201 | 202 | # echo '@define-color menubar_bg_color @theme_bg_color;' >> "${1:-$PWD}/gtk.css" 203 | # echo '@define-color menubar_fg_color @theme_fg_color;' >> "${1:-$PWD}/gtk.css" 204 | # echo '@define-color toolbar_bg_color @theme_bg_color;' >> "${1:-$PWD}/gtk.css" 205 | # echo '@define-color toolbar_fg_color @theme_fg_color;' >> "${1:-$PWD}/gtk.css" 206 | # echo '@define-color menu_bg_color @theme_base_color;' >> "${1:-$PWD}/gtk.css" 207 | # echo '@define-color menu_fg_color @theme_text_color;' >> "${1:-$PWD}/gtk.css" 208 | # echo '@define-color panel_bg_color @theme_bg_color;' >> "${1:-$PWD}/gtk.css" 209 | # echo '@define-color panel_fg_color @theme_fg_color;' >> "${1:-$PWD}/gtk.css" 210 | 211 | # echo '@define-color osd_base '"${themeColors[2]}"';' >> "${1:-$PWD}/gtk.css" 212 | # echo '@define-color osd_fg '"${themeColors[13]}"';' >> "${1:-$PWD}/gtk.css" 213 | # echo '@define-color osd_bg alpha(@osd_base, 0.8);' >> "${1:-$PWD}/gtk.css" 214 | 215 | 216 | # echo '@import url("gtk-widgets.css");' >> "${1:-$PWD}/gtk.css" 217 | # echo '@import url("gtk-widgets-assets.css");' >> "${1:-$PWD}/gtk.css" 218 | 219 | # echo '[Settings]' > "${1:-$PWD}/settings.ini" 220 | # echo "gtk-theme-name=${GTK_THEME}" >> "${1:-$PWD}/settings.ini" 221 | # echo "gtk-font-name=${NORMAL_FONT} ${FONT_SIZE}" >> "${1:-$PWD}/settings.ini" 222 | # echo "gtk-icon-theme-name=${ICON_THEME}" >> "${1:-$PWD}/settings.ini" 223 | # echo "gtk-application-prefer-dark-theme=1" >> "${1:-$PWD}/settings.ini" 224 | # echo "gtk-cursor-theme-name=${CURSOR_THEME}" >> "${1:-$PWD}/settings.ini" 225 | # echo "gtk-cursor-theme-size=0" >> "${1:-$PWD}/settings.ini" 226 | #echo 'gtk-color-scheme = "' >> "${1:-$PWD}/settings.ini" 227 | #echo 'base_color:'"${themeColors[14]}"'' >> "${1:-$PWD}/settings.ini" 228 | #echo 'bg_color:'"${themeColors[15]}"'' >> "${1:-$PWD}/settings.ini" 229 | #echo 'selected_bg_color:'"${themeColors[5]}"'' >> "${1:-$PWD}/settings.ini" 230 | #echo 'text_color:'"${themeColors[2]}"'' >> "${1:-$PWD}/settings.ini" 231 | #echo 'fg_color:'"${themeColors[15]}"'' >> "${1:-$PWD}/settings.ini" 232 | #echo 'selected_fg_color:'"${themeColors[13]}"'' >> "${1:-$PWD}/settings.ini" 233 | #echo 'link_color:'"${themeColors[7]}"'' >> "${1:-$PWD}/settings.ini" 234 | #echo 'toolbar_bg_color:'"${themeColors[0]}"'' >> "${1:-$PWD}/settings.ini" 235 | #echo 'toolbar_fg_color:'"${themeColors[15]}"'' >> "${1:-$PWD}/settings.ini" 236 | #echo 'menubar_bg_color:'"${themeColors[0]}"'' >> "${1:-$PWD}/settings.ini" 237 | #echo 'menubar_fg_color:'"${themeColors[15]}"'' >> "${1:-$PWD}/settings.ini" 238 | #echo 'menu_bg_color:'"${themeColors[14]}"'' >> "${1:-$PWD}/settings.ini" 239 | #echo 'menu_fg_color:'"${themeColors[2]}"'"' >> "${1:-$PWD}/settings.ini" 240 | #echo 'gtk-auto-mnemonics = 1' >> "${1:-$PWD}/settings.ini" 241 | #echo 'gtk-visible-focus = automatic' >> "${1:-$PWD}/settings.ini" 242 | 243 | echo 'gtk-xft-antialias=0' >> "${1:-$PWD}/settings.ini" 244 | echo 'gtk-xft-hinting=0' >> "${1:-$PWD}/settings.ini" 245 | echo 'gtk-xft-hintstyle="hintnone"' >> "${1:-$PWD}/settings.ini" 246 | echo 'gtk-xft-rgba="rgb"' >> "${1:-$PWD}/settings.ini" 247 | } 248 | 249 | function create_luakit(){ 250 | cp ~/.config/luakit/theme.lua "${1:-$PWD}/theme.lua" 251 | sed -i "s|bg.*|bg = \"${themeColors[1]}\"|" "${1:-$PWD}/theme.lua" 252 | sed -i "s|fg.*|fg = \"${themeColors[14]}\"|" "${1:-$PWD}/theme.lua" 253 | 254 | sed -i "s|selected_bg.*|selected_bg = \"${themeColors[0]}\"|" "${1:-$PWD}/theme.lua" 255 | sed -i "s|selected_fg.*|selected_fg = \"${themeColors[15]}\"|" "${1:-$PWD}/theme.lua" 256 | 257 | sed -i "s|success_fg.*|success_fg = \"${themeColors[7]}\"|" "${1:-$PWD}/theme.lua" 258 | sed -i "s|loaded_fg.*|loaded_fg = \"${themeColors[12]}\"|" "${1:-$PWD}/theme.lua" 259 | sed -i "s|error_fg.*|error_fg = \"${themeColors[5]}\"|" "${1:-$PWD}/theme.lua" 260 | sed -i "s|error_bg.*|error_bg = \"${themeColors[2]}\"|" "${1:-$PWD}/theme.lua" 261 | sed -i "s|warning_fg.*|warning_fg = \"${themeColors[9]}\"|" "${1:-$PWD}/theme.lua" 262 | sed -i "s|warning_bg.*|warning_bg = \"${themeColors[2]}\"|" "${1:-$PWD}/theme.lua" 263 | sed -i "s|ntheme.*|ntheme = \"${themeColors[7]}\"|" "${1:-$PWD}/theme.lua" 264 | } 265 | 266 | function create_startpage(){ 267 | echo '' > "${1:-$PWD}/home.html" 268 | } 269 | 270 | function create_dunst(){ 271 | cp ~/.config/dunst/dunstrc "${1:-$PWD}/dunstrc" 272 | sed -i 's/color.*/color = "'"${themeColors[2]}"'"/' "${1:-$PWD}/dunstrc" 273 | sed -i 's/separator_color.*/separator_color = "'"${themeColors[3]}"'"/' "${1:-$PWD}/dunstrc" 274 | sed -i 's/background.*/background = "'"${themeColors[0]}"'"/' "${1:-$PWD}/dunstrc" 275 | #sed -i 's/foreground.*/foreground = "'"${LOW_COLOR}"'"/1' "${1:-$PWD}/dunstrc" 276 | sed -i 's/foreground.*/foreground = "'"${themeColors[15]}"'"/g' "${1:-$PWD}/dunstrc" 277 | #sed -i 's/foreground.*/foreground = "'"${CRT_COLOR}"'"/3' "${1:-$PWD}/dunstrc" 278 | } 279 | 280 | create_xres ${@} 281 | create_term ${@} 282 | create_dunst ${@} 283 | #create_gtk ${@} 284 | #create_luakit ${@} 285 | #create_startpage ${@} -------------------------------------------------------------------------------- /src/col2upd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #echo "scale=2; 55+(55/255)*75" | bc -s | awk -F '.' '{print $1}' 4 | #exit 5 | 6 | function getll(){ 7 | local r="${1}" 8 | local g="${2}" 9 | local b="${3}" 10 | 11 | # http://stackoverflow.com/a/596241 12 | #echo "scale=0; (${r}+${r}+${b}+${g}+${g}+${g})/6" | bc -s 13 | 14 | echo "scale=0; (${r}+${g}+${b})/3" | bc -s 15 | } 16 | 17 | function maxll(){ 18 | local r="${1:-0}" 19 | local g="${2:-0}" 20 | local b="${3:-0}" 21 | 22 | if [[ "${r}" -gt "${g}" && "${r}" -gt "${b}" ]]; then 23 | #echo "RED!" 24 | echo "${r}" 25 | elif [[ "${g}" -gt "${r}" && "${g}" -gt "${b}" ]]; then 26 | #echo "GREEN!" 27 | echo "${g}" 28 | elif [[ "${b}" -gt "${r}" && "${b}" -gt "${g}" ]]; then 29 | #echo "BLUE!" 30 | echo "${b}" 31 | else 32 | #echo "NONE!" 33 | echo "${r}" 34 | fi 35 | } 36 | 37 | function minll(){ 38 | local r="${1:-0}" 39 | local g="${2:-0}" 40 | local b="${3:-0}" 41 | 42 | if [[ "${r}" -lt "${g}" && "${r}" -lt "${b}" ]]; then 43 | #echo "RED!" 44 | echo "${r}" 45 | elif [[ "${g}" -lt "${r}" && "${g}" -lt "${b}" ]]; then 46 | #echo "GREEN!" 47 | echo "${g}" 48 | elif [[ "${b}" -lt "${r}" && "${b}" -lt "${g}" ]]; then 49 | #echo "BLUE!" 50 | echo "${b}" 51 | else 52 | #echo "NONE!" 53 | echo "${r}" 54 | fi 55 | } 56 | 57 | # Fix lightlevel for color if too bright or too dark 58 | function chll(){ 59 | #echo "scale=2; ${4}" | bc -s 60 | #exit 61 | 62 | # TODO: Make it upgrade strongest color first, then the others. 63 | # Example: Red has 235 and all colors should be loosing 53 points in total. 64 | # Calculate how many of red points has to be removed compared to the others 65 | local r=$(echo "scale=2; ${1}+(${1}*${4}/3/255)" | bc -s | awk -F '.' '{print $1}') 66 | local g=$(echo "scale=2; ${2}+(${2}*${4}/3/255)" | bc -s | awk -F '.' '{print $1}') 67 | local b=$(echo "scale=2; ${3}+(${3}*${4}/3/255)" | bc -s | awk -F '.' '{print $1}') 68 | 69 | [[ "${r}" -lt 0 ]] && r=0 70 | [[ "${g}" -lt 0 ]] && g=0 71 | [[ "${b}" -lt 0 ]] && b=0 72 | 73 | [[ "${r}" -gt 255 ]] && r=255 74 | [[ "${g}" -gt 255 ]] && g=255 75 | [[ "${b}" -gt 255 ]] && b=255 76 | 77 | echo "${r} ${g} ${b}" 78 | } 79 | 80 | # Bound light level to a specific range 81 | function bndll(){ 82 | local r="${1}" 83 | local g="${2}" 84 | local b="${3}" 85 | 86 | local curLL=$(getll "${r}" "${g}" "${b}") 87 | local minCur=$(minll "${r}" "${g}" "${b}") 88 | local maxCur=$(maxll "${r}" "${g}" "${b}") 89 | local minLL="${4}" 90 | local maxLL="${5}" 91 | 92 | #echo "COLOR BEFORE [${r} ${g} ${b}]" 93 | 94 | if [[ "${curLL}" -gt "${maxLL}" ]]; then 95 | local change=$((${maxLL} -${maxCur})) 96 | #echo "TOO HIGH,- CHANGE: ${change}" 97 | echo $(chll "${r}" "${g}" "${b}" "${change}") 98 | elif [[ "${curLL}" -lt "${minLL}" ]]; then 99 | local change=$((${minLL} -${minCur})) 100 | #echo "TOO LOW,- CHANGE: ${change}" 101 | echo $(chll "${r}" "${g}" "${b}" "${change}") 102 | else 103 | #echo "ALL OK,- REPRINT" 104 | echo "${r} ${g} ${b}" 105 | fi 106 | } 107 | 108 | function trim_string(){ 109 | echo "${1}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' 110 | } 111 | 112 | function hex2rgb(){ 113 | local hexcode=$(echo "${1}" | tr -d '#' | tr '[:lower:]' '[:upper:]') 114 | 115 | for val in ${hexcode:0:2} ${hexcode:2:2} ${hexcode:4:2}; do 116 | printf "%3d " "0x$val" 117 | done 118 | } 119 | 120 | function rgb2hex(){ 121 | printf \#%02X%02X%02X "${1}" "${2}" "${3}" 122 | } 123 | 124 | hex='#52F288' 125 | echo "${hex}" 126 | 127 | rgb=$(hex2rgb "${hex}") 128 | 129 | echo "${rgb} LL: $(getll ${rgb})" 130 | maxll ${rgb} 131 | 132 | #rgb=$(chll ${rgb} -75) 133 | rgb=$(bndll ${rgb} 50 100) 134 | 135 | echo "${rgb} LL: $(getll ${rgb})" 136 | 137 | #hex=$(rgb2hex ${rgb}) 138 | #echo "${hex}" 139 | 140 | # https://wiki.archlinux.org/index.php/x_resources#Terminal_colors 141 | # Black + DarkGrey 142 | # *color0: #000000 143 | # *color8: #555753 144 | # DarkRed + Red 145 | # *color1: #ff6565 146 | # *color9: #ff8d8d 147 | # DarkGreen + Green 148 | # *color2: #93d44f 149 | # *color10: #c8e7a8 150 | # DarkYellow + Yellow 151 | # color3: #eab93d 152 | # color11: #ffc123 153 | # DarkBlue + Blue 154 | # color4: #204a87 155 | # color12: #3465a4 156 | # DarkMagenta + Magenta 157 | # color5: #ce5c00 158 | # color13: #f57900 159 | # DarkCyan + Cyan (both not tango) 160 | # color6: #89b6e2 161 | # color14: #46a4ff 162 | # LightGrey + White 163 | # color7: #cccccc 164 | # color15: #ffffff -------------------------------------------------------------------------------- /src/dir2thm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | scriptDir=$(dirname `realpath -P "$0"`) 4 | imageDir=${1:-$HOME/pictures/wallpapers/} 5 | 6 | for fName in "${imageDir}"*; do 7 | echo "${fName}" | "${scriptDir}/img2thm" 8 | done -------------------------------------------------------------------------------- /src/font2sys: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function update_xres(){ 4 | sed -i -e "s|ont:.*|ont: xft:${NORMAL_FONT}:size=${FONT_SIZE}|" ~/.config/font/fontrc 5 | } 6 | 7 | function update_gtk(){ 8 | sed -i "s|gtk-theme-name.*|gtk-theme-name=${GTK_THEME}|" ~/.config/gtk-3.0/settings.ini 9 | sed -i "s|gtk-font-name.*|gtk-font-name=${NORMAL_FONT} ${FONT_SIZE}|" ~/.config/gtk-3.0/settings.ini 10 | sed -i "s|gtk-icon-theme-name.*|gtk-icon-theme-name=${ICON_THEME}|" ~/.config/gtk-3.0/settings.ini 11 | sed -i "s|gtk-cursor-theme-name.*|gtk-cursor-theme-name=${CURSOR_THEME}|" ~/.config/gtk-3.0/settings.ini 12 | } 13 | 14 | update_xres 15 | #echo -e "\n" 16 | update_gtk -------------------------------------------------------------------------------- /src/img2col: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Image 2 Colors: Extract 16 dominant colors from an image 4 | 5 | image="${1:-$IMAGE}" 6 | 7 | # Taken from http://softwarerecs.stackexchange.com/a/14652 8 | 9 | function get_colors(){ 10 | convert "${1}" -colors 16 -depth 8 -format '%c' histogram:info:- \ 11 | | sort --reverse --numeric-sort \ 12 | | gawk 'match ($0, /^ *[0-9]+: \([^)]+\) (#[0-9A-F]+) .+$/, a) { print a[1] }' 13 | } 14 | 15 | if [[ "${image}" != "" ]]; then 16 | get_colors "${image}" 17 | else 18 | while read fName; do 19 | get_colors "${fName}" 20 | done < "${image:-/dev/stdin}" 21 | fi -------------------------------------------------------------------------------- /src/img2thm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | scriptDir=$(dirname `realpath -P "$0"`) 4 | image="${1:-$IMAGE}" 5 | 6 | function merge_colors(){ 7 | local greyColors=('#181818' '#282828' '#383838' '#585858' '#b8b8b8' '#d8d8d8' '#e8e8e8' '#f8f8f8') 8 | echo -e "${greyColors[@]} ${@}" | tr ' ' '\n' 9 | } 10 | 11 | function main(){ 12 | local fName="${1}" 13 | 14 | if [[ -f "${fName}" ]]; then 15 | local themeDir="${HOME}/.wp-themes/$(md5sum ${fName} | awk -F ' ' '{print $1}')" 16 | 17 | if [[ -d "${themeDir}" ]] && [[ "${FORCE_UPDATE}" == "" ]]; then 18 | echo -e "[INFO] Theme for \"${fName}\" already generated. Saved as \"${themeDir}\"\n" 19 | return 20 | fi 21 | 22 | echo -e "[INFO] Generating theme for \"${fName}\". Saving as \"${themeDir}\"\n" 23 | 24 | mkdir -p "${themeDir}" 25 | 26 | local midColors=$(echo "${fName}" | "${scriptDir}/img2col" | "${scriptDir}/col2mid") 27 | local fullColors=$(merge_colors ${midColors}) 28 | echo -e "${fullColors}" > "${themeDir}/palette.list" 29 | #echo "${fName}" | "${scriptDir}/img2col" | "${scriptDir}/col2pal" "${themeDir}/palette.list" 30 | #echo -e "$(xres2col ~/downloads/base16-default.dark.xresources)" > "${themeDir}/palette.list" 31 | cat "${themeDir}/palette.list" | "${scriptDir}/col2prv" "${themeDir}/preview.png" 32 | cat "${themeDir}/palette.list" | "${scriptDir}/col2thm" "${themeDir}" 33 | echo "${fName}" > "${themeDir}/wallpaper.txt" 34 | else 35 | echo -e "[INFO] File not found: \"${fName}\"" 36 | fi 37 | } 38 | 39 | if [[ "${image}" != "" ]]; then 40 | main "${image}" 41 | else 42 | while read fName; do 43 | main "${fName}" 44 | done < "${image:-/dev/stdin}" 45 | fi 46 | 47 | -------------------------------------------------------------------------------- /src/img2wal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | image="${1:-$IMAGE}" 4 | 5 | while read fName; do 6 | if [[ -f "${fName}" ]]; then 7 | feh --no-fehbg --bg-fill "${fName}" 8 | #echo "${fName}" | tee '/tmp/.wallpaper' 9 | exit 10 | fi 11 | done < "${image:-/dev/stdin}" -------------------------------------------------------------------------------- /src/rnd2wal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # based of http://alssndro.github.io/trianglify-background-generator/ -------------------------------------------------------------------------------- /src/thm2surf: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | -------------------------------------------------------------------------------- /src/thm2sys: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Requires package pygtk 4 | function reload_gtk(){ 5 | python2 - <' | awk -F '"' '{print $2}' | sort -R | head -n 1 | sed 's/wallpaper/image/2') 28 | rndWall="https:${rndWall}_${resolution}.jpg" 29 | fName=$(echo "${rndWall}" | awk -F '/' '{print $5}') 30 | 31 | if [[ -f "${folder}/${fName}" ]]; then 32 | echo "Skipping download of ${fName}: File already exists" 33 | else 34 | echo "Downloading ${fName}" 35 | wget -q -P "${folder}" "${rndWall}" 36 | fi 37 | 38 | #if [[ "${autoChange}" == "yes" ]]; then 39 | #~/.config/bspwm/change_theme "${fName}" 40 | #fi -------------------------------------------------------------------------------- /src/xres2col: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | grep 'define base' "${1:-$HOME/.Xresources}" | awk -F ' ' '{print $3}' -------------------------------------------------------------------------------- /src/xres2thm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | scriptDir=$(dirname `realpath -P "$0"`) 4 | xFile=${1:-$HOME/.Xresources} 5 | colors=$(xres2col "${xFile}") 6 | themeDir="${HOME}/.wp-themes/$(echo "${colors}" | md5sum | awk -F ' ' '{print $1}')" 7 | 8 | if [[ -d "${themeDir}" ]] && [[ "${FORCE_UPDATE}" == "" ]]; then 9 | echo -e "[INFO] Theme for \"${xFile}\" already generated. Saved as \"${themeDir}\"\n" 10 | exit 11 | fi 12 | 13 | echo -e "[INFO] Generating theme for \"${xFile}\". Saving as \"${themeDir}\"\n" 14 | 15 | mkdir -p "${themeDir}" 16 | 17 | echo -e "${colors}" > "${themeDir}/palette.list" 18 | cat "${themeDir}/palette.list" | "${scriptDir}/col2prv" "${themeDir}/preview.png" 19 | cat "${themeDir}/palette.list" | "${scriptDir}/col2thm" "${themeDir}" -------------------------------------------------------------------------------- /src/xres2var: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Use like: eval "$(xres2var)" 4 | grep -o -E 'base0[0-9|A-F] #[0-9|a-z|A-Z]*' ~/.Xresources | awk -F ' ' '{print $1"=\""$2"\""}' --------------------------------------------------------------------------------