]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/imagesources/maketoolbarpics.sh
New toolbar button icons
[working/Evergreen.git] / Open-ILS / xul / staff_client / imagesources / maketoolbarpics.sh
1 #!/bin/bash
2
3 INKSCAPESCRIPT=""
4 ALLICONS=""
5
6 # Build alt color sets! All start with blue
7 # ORANGE - RGB -> BGR
8 mkdir -p toolbar_orange
9 for file in `ls toolbar_blue/blue_*`; do sed -e 's/"#\([0-9A-Fa-f]\{2\}\)\([0-9A-Fa-f]\{2\}\)\([0-9A-Fa-f]\{2\}\)"/"#\3\2\1"/' -e 's/"#\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)"/"#\3\2\1"/' $file > `echo $file | sed -e 's/blue/orange/g'`; done
10 # Green - RGB -> GBR
11 mkdir -p toolbar_green
12 for file in `ls toolbar_blue/blue_*`; do sed -e 's/"#\([0-9A-Fa-f]\{2\}\)\([0-9A-Fa-f]\{2\}\)\([0-9A-Fa-f]\{2\}\)"/"#\2\3\1"/' -e 's/"#\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)"/"#\2\3\1"/' $file > `echo $file | sed -e 's/blue/green/g'`; done
13 # Fuschia - RGB -> BRG
14 mkdir -p toolbar_fuschia
15 for file in `ls toolbar_blue/blue_*`; do sed -e 's/"#\([0-9A-Fa-f]\{2\}\)\([0-9A-Fa-f]\{2\}\)\([0-9A-Fa-f]\{2\}\)"/"#\3\1\2"/' -e 's/"#\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)"/"#\3\1\2"/' $file > `echo $file | sed -e 's/blue/fuschia/g'`; done
16 # Teal - RGB -> RBG
17 mkdir -p toolbar_teal
18 for file in `ls toolbar_blue/blue_*`; do sed -e 's/"#\([0-9A-Fa-f]\{2\}\)\([0-9A-Fa-f]\{2\}\)\([0-9A-Fa-f]\{2\}\)"/"#\1\3\2"/' -e 's/"#\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)"/"#\1\3\2"/' $file > `echo $file | sed -e 's/blue/teal/g'`; done
19 # Purple - RGB -> GRB
20 mkdir -p toolbar_purple
21 for file in `ls toolbar_blue/blue_*`; do sed -e 's/"#\([0-9A-Fa-f]\{2\}\)\([0-9A-Fa-f]\{2\}\)\([0-9A-Fa-f]\{2\}\)"/"#\2\1\3"/' -e 's/"#\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)\([0-9A-Fa-f]\)"/"#\2\1\3"/' $file > `echo $file | sed -e 's/blue/purple/g'`; done
22
23 mkdir -p pngfiles_working
24 rm -f pngfiles_working/*
25
26 # Start by exporting all the svg files as png files
27 # This also collects icon names for later, and notes those that have no disabled icon
28 for color in blue orange green fuschia teal purple
29 do
30     for icon in $( ls toolbar_$color/${color}_*.svg | cut -f1 -d. | cut -f2- -d/ | cut -f2- -d_  )
31     do
32         if [ "$color" == "blue" ]; then
33             ALLICONS="$ALLICONS $icon"
34         fi
35         INKSCAPESCRIPT="$INKSCAPESCRIPT
36 -w 32 -e pngfiles_working/${color}_${icon}_active_32.png toolbar_$color/${color}_${icon}.svg
37 -w 16 -e pngfiles_working/${color}_${icon}_active_16.png toolbar_$color/${color}_${icon}.svg"
38     done
39 done
40 # Do the full export in one inkscape session
41 echo "$INKSCAPESCRIPT" | inkscape --shell
42
43 # Now make disabled variants
44 for file in `ls pngfiles_working/*active*`
45 do
46     convert $file -fx '(r+g+b)/3' `echo $file | sed -e 's/active/disabled/'`
47 done
48
49 mkdir -p pngfiles_complete
50
51 # Now we need to assemble the icons. For this we use imagemagick to combine 4 (or 8?) images into one.
52 for icon in $ALLICONS
53 do
54     for color in blue orange green fuschia teal purple
55     do
56         mkdir -p pngfiles_complete/toolbar_$color
57         convert \( pngfiles_working/${color}_${icon}_active_32.png pngfiles_working/${color}_${icon}_disabled_32.png -append \) \
58                 \( pngfiles_working/${color}_${icon}_active_16.png pngfiles_working/${color}_${icon}_disabled_16.png -append \) \
59                 -background none +append pngfiles_complete/toolbar_$color/${icon}_toolbar.png
60     done
61 done