164 lines
4.7 KiB
Bash
Executable File
164 lines
4.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# w2theme - generate themes from wallpaper colors
|
|
|
|
WALLPALDIR="$HOME/.config/colormenu/palettes/wallp"
|
|
mkdir -p "$WALLPALDIR"
|
|
read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2)
|
|
WALLPAPER=${WALLPATH##*/}
|
|
if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then
|
|
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$WALLPAPER.clr"
|
|
fi
|
|
mapfile -t w < "$WALLPALDIR/$WALLPAPER.clr"
|
|
|
|
if [[ "${#w[@]}" -lt 8 ]]; then
|
|
w+=("#2e3440" "#4c566a" "#5e81ac" "#bf616b" "#b48ead" "#a3be8c" "#ebcb8b" "#d8dee9" "#eceff4")
|
|
fi
|
|
|
|
menu_theme () {
|
|
case "$1" in
|
|
dark) #dark bg
|
|
jgctl color_menu_bg "${w[0]}"
|
|
jgctl color_menu_bg_to "${w[1]}"
|
|
jgctl color_norm_fg "${w[-2]}"
|
|
jgctl color_title_bg "${w[2]}"
|
|
jgctl color_title_fg "${w[-2]}"
|
|
jgctl color_title_border "${w[3]}"
|
|
jgctl color_sel_bg "${w[4]}"
|
|
jgctl color_sel_fg "${w[-1]}"
|
|
jgctl color_sel_border "${w[3]}"
|
|
jgctl color_sep_fg "${w[3]}"
|
|
#sleep 1
|
|
;;
|
|
*) #light bg
|
|
jgctl color_menu_bg "${w[-1]}"
|
|
jgctl color_menu_bg_to "${w[-2]}"
|
|
jgctl color_norm_fg "${w[1]}"
|
|
jgctl color_title_bg "${w[-3]}"
|
|
jgctl color_title_fg "${w[1]}"
|
|
jgctl color_title_border "${w[-4]}"
|
|
jgctl color_sel_bg "${w[-5]}"
|
|
jgctl color_sel_fg "${w[0]}"
|
|
jgctl color_sel_border "${w[-4]}"
|
|
jgctl color_sep_fg "${w[-5]}"
|
|
#sleep 1
|
|
;;
|
|
esac
|
|
}
|
|
conky_colors() {
|
|
case "$1" in
|
|
dark) #dark bg
|
|
conkyctl win_bgcolor_all "${w[0]}"
|
|
conkyctl default_color_all "${w[-1]}"
|
|
conkyctl color0_all "${w[-3]}"
|
|
conkyctl color1_all "${w[-4]}"
|
|
conkyctl color2_all "${w[-5]}"
|
|
;;
|
|
*) #light bg
|
|
conkyctl win_bgcolor_all "${w[-1]}"
|
|
conkyctl default_color_all "${w[0]}"
|
|
conkyctl color0_all "${w[2]}"
|
|
conkyctl color1_all "${w[4]}"
|
|
conkyctl color2_all "${w[6]}"
|
|
;;
|
|
esac
|
|
}
|
|
pyradio_theme() {
|
|
case "$1" in
|
|
dark) #dark bg
|
|
prtctl stations "${w[-3]}" "${w[0]}"
|
|
prtctl active_station "${w[-1]}"
|
|
prtctl status_bar "${w[0]}" "${w[-3]}"
|
|
prtctl normal_cursor "${w[1]}" "${w[-4]}"
|
|
prtctl active_cursor "${w[2]}" "${w[-3]}"
|
|
prtctl edit_cursor "${w[2]}" "${w[-3]}"
|
|
prtctl extra_func "${w[6]}"
|
|
prtctl pyradio_url "${w[2]}"
|
|
prtctl messages_border "${w[2]}"
|
|
;;
|
|
*) # light bg
|
|
prtctl stations "${w[4]}" "${w[-1]}"
|
|
prtctl active_station "${w[0]}"
|
|
prtctl status_bar "${w[0]}" "${w[-3]}"
|
|
prtctl normal_cursor "${w[4]}" "${w[-3]}"
|
|
prtctl active_cursor "${w[2]}" "${w[-3]}"
|
|
prtctl edit_cursor "${w[2]}" "${w[-3]}"
|
|
prtctl extra_func "${w[6]}"
|
|
prtctl pyradio_url "${w[2]}"
|
|
prtctl messages_border "${w[4]}"
|
|
;;
|
|
esac
|
|
}
|
|
accent () {
|
|
obtctl clractivebg ${1}
|
|
colorTo=$(pastel darken 0.1 "${1}"|pastel format hex)
|
|
# JGMENU based menus, sidepanels and tools
|
|
jgctl color_title_bg ${colorTo}
|
|
#TITLE_FG=$(pastel textcolor ${colorTo}|pastel format hex)
|
|
TITLE_FG=$(pastel mix -f 0.4 ${colorTo} $(pastel textcolor ${colorTo})|pastel format hex)
|
|
SEL_FG=$(pastel textcolor ${1}|pastel format hex)
|
|
#notify-send.sh "FG" "${TITLE_FG}"
|
|
jgctl color_title_fg ${TITLE_FG}
|
|
jgctl color_title_border ${1}
|
|
jgctl color_sel_bg ${1}
|
|
jgctl color_sel_fg ${SEL_FG}
|
|
}
|
|
|
|
colorize () {
|
|
source ~/.config/colorizer/colorizer.conf
|
|
# CONKY
|
|
case "$wall2themes_conky" in
|
|
dark) conky_colors dark;;
|
|
light) conky_colors light;;
|
|
*) : ;;
|
|
esac
|
|
# MENUS
|
|
case "$wall2themes_menu" in
|
|
dark) menu_theme dark;;
|
|
light) menu_theme light;;
|
|
*) : ;;
|
|
esac
|
|
# ACCENT_COLOR
|
|
case "$wall2themes_accent" in
|
|
dark)
|
|
obtctl theme MBcolors
|
|
accent ${w[1]}
|
|
;;
|
|
light)
|
|
obtctl theme MBcolors
|
|
accent ${w[-1]}
|
|
;;
|
|
*) : ;;
|
|
esac
|
|
# PYRADIO THEME
|
|
case "$wall2themes_pyradio" in
|
|
dark) pyradio_theme dark;;
|
|
light) pyradio_theme light;;
|
|
*) : ;;
|
|
esac
|
|
}
|
|
|
|
pin () {
|
|
#get wallpaper path and filename without ext
|
|
|
|
# mkdir for colorscheme
|
|
mkdir -p ~/.config/colorizer/pinned/$WALLNAME
|
|
# if dir exist then action is update so remove old content
|
|
rm -rf ~/.config/colorizer/pinned/$WALLNAME
|
|
|
|
# get menu themename jgmenu_theme= ( it is always MBcolors ????)
|
|
. ~/.config/mabox/mabox.conf
|
|
|
|
}
|
|
|
|
case "$1" in
|
|
ob) obtheme "$2";;
|
|
menu) menu_theme "$2";;
|
|
conky) conky_colors "$2";;
|
|
pyradio) pyradio_theme "$2";;
|
|
accent) accent "$2";;
|
|
colorize) colorize;;
|
|
pin) pin;;
|
|
*) ;;
|
|
esac
|