parent
0fa2536dac
commit
aad57c20d0
18
bin/w2theme
18
bin/w2theme
|
@ -18,14 +18,22 @@
|
|||
|
||||
# w2theme - generate themes from wallpaper colors
|
||||
|
||||
WALLPALDIR="$HOME/.config/colormenu/palettes/wallp"
|
||||
WALLPALDIR="$HOME/.cache/colorizer/palettes"
|
||||
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"
|
||||
|
||||
NAME=${WALLPATH////_}
|
||||
if [[ "${NAME}" =~ ^_home_.* ]]; then
|
||||
n=${#HOME}
|
||||
((n++))
|
||||
NAME=${NAME:${n}}
|
||||
fi
|
||||
mapfile -t w < "$WALLPALDIR/$WALLPAPER.clr"
|
||||
|
||||
|
||||
if [ ! -f "$WALLPALDIR/$NAME.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/$NAME.clr"
|
||||
fi
|
||||
mapfile -t w < "$WALLPALDIR/$NAME.clr"
|
||||
|
||||
if [[ "${#w[@]}" -lt 8 ]]; then
|
||||
w+=("#2e3440" "#4c566a" "#5e81ac" "#bf616b" "#b48ead" "#a3be8c" "#ebcb8b" "#d8dee9" "#eceff4")
|
||||
|
|
Loading…
Reference in New Issue