Advertisement
Guest User

monochrome.sh

a guest
Jun 14th, 2016
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.02 KB | None | 0 0
  1. cd svgs/depot
  2.  
  3. dark=363b40
  4.  
  5. echo Fill and stroke colors before:
  6. grep 'opacity:1;fill:#' *.svg|awk -F 'fill' '{print $2}'|sort|uniq -c|sort -nr
  7. grep 'opacity:1;stroke:#' *.svg|awk -F 'stroke' '{print $2}'|sort|uniq -c|sort -nr
  8. grep 'fill:none;stroke:#' *.svg|awk -F 'stroke' '{print $2}'|sort|uniq -c|sort -nr
  9. grep 'fill:#......;opacity:1' *.svg|awk -F 'fill' '{print $2}'|awk -F ';opacity' '{print $1}'|sort|uniq -c|sort -nr
  10. grep 'fill:#......;fill-opacity:1' *.svg|awk -F 'fill' '{print $2}'|sort|uniq -c|sort -nr
  11.  
  12. for i in *svg
  13. do
  14.     for col in 009688 00bcd4 03a9f4 2196f3 3f51b5 4caf50 607d8b 673ab7 795548 8bc34a 9c27b0 9e9e9e cddc39 e91e5a e91e63 f44336 ff5722 ff9800 ffc107 ffeb3b
  15.     do
  16.         if [ `grep -hc 'opacity:1;fill:#'$col $i` != 0 ]
  17.         then
  18.             sed -i -e 's/opacity:1;fill:#'$col'/opacity:1;fill:#'$dark'/g' $i
  19.         fi
  20.         if [ `grep -hc 'opacity:1;stroke:#'$col $i` != 0 ]
  21.         then
  22.             sed -i -e 's/opacity:1;stroke:#'$col'/opacity:1;stroke:#'$dark'/g' $i
  23.         fi
  24.         if [ `grep -hc 'fill:none;stroke:#'$col $i` != 0 ]
  25.         then
  26.             sed -i -e 's/fill:none;stroke:#'$col'/fill:none;stroke:#'$dark'/g' $i
  27.         fi
  28.         if [ `grep -hc 'fill:#'$col';opacity:1' $i` != 0 ]
  29.         then
  30.             sed -i -e 's/fill:#'$col';opacity:1/fill:#'$dark';opacity:1/g' $i
  31.         fi
  32.         if [ `grep -hc 'fill:#'$col';fill-opacity:1' $i` != 0 ]
  33.         then
  34.             sed -i -e 's/fill:#'$col';fill-opacity:1/fill:#'$dark';opacity:1/g' $i
  35.         fi
  36.     done
  37. done
  38.  
  39. echo Fill and stroke colors after:
  40. grep 'opacity:1;fill:#' *.svg|awk -F 'fill' '{print $2}'|sort|uniq -c|sort -nr
  41. grep 'opacity:1;stroke:#' *.svg|awk -F 'stroke' '{print $2}'|sort|uniq -c|sort -nr
  42. grep 'fill:none;stroke:#' *.svg|awk -F 'stroke' '{print $2}'|sort|uniq -c|sort -nr
  43. grep 'fill:#......;opacity:1' *.svg|awk -F 'fill' '{print $2}'|awk -F ';opacity' '{print $1}'|sort|uniq -c|sort -nr
  44. grep 'fill:#......;fill-opacity:1' *.svg|awk -F 'fill' '{print $2}'|sort|uniq -c|sort -nr
  45.  
  46. cd ../..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement