-
-
Notifications
You must be signed in to change notification settings - Fork 486
/
mk_icn_res.sh
72 lines (55 loc) · 2.52 KB
/
mk_icn_res.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
#
# make icons using Inkscape
ICON="kicad
pcbnew
eeschema
gerbview
bitmap2component
pcbcalculator"
SIZE="16x16
24x24
32x32
48x48
64x64
128x128"
# create output directories
rm -r ../resources/linux/icons/hicolor/*
rm -r ../resources/linux/icons-nightly/hicolor/*
mkdir -p ../resources/linux/icons/hicolor/scalable/mimetypes ../resources/linux/icons/hicolor/scalable/apps
mkdir -p ../resources/linux/icons-nightly/hicolor/scalable/apps
echo -e '\E[0;34m'"Directory \"scalable\" for .svg icons was created."
tput sgr0
# copy sources to the scalable dir
cp ./sources/light/icon_kicad.svg ../resources/linux/icons/hicolor/scalable/mimetypes/application-x-kicad-project.svg
cp ./sources/light/icon_pcbnew.svg ../resources/linux/icons/hicolor/scalable/mimetypes/application-x-kicad-pcb.svg
cp ./sources/light/icon_eeschema.svg ../resources/linux/icons/hicolor/scalable/mimetypes/application-x-kicad-schematic.svg
for icon in $ICON
do
cp ./sources/light/icon_$icon.svg ../resources/linux/icons/hicolor/scalable/apps/$icon.svg
done
cp ./sources/light/icon_kicad_nightly.svg ../resources/linux/icons-nightly/hicolor/scalable/apps/kicad.svg
echo -e '\E[0;34m'"Sources of icons were copied."
tput sgr0
# convert .svg files into .png files
for size in $SIZE
do
sz=${size%x*}
source_sz=""
if [ $sz -le 32 ]
then
source_sz="_$sz"
fi
echo -e '\E[0;32m'"\nMaking icons with size $size from \"source$source_sz\"."
tput sgr0
mkdir -p ../resources/linux/icons/hicolor/$size/mimetypes ../resources/linux/icons/hicolor/$size/apps
mkdir -p ../resources/linux/icons-nightly/hicolor/$size/apps
inkscape -o ../resources/linux/icons/hicolor/$size/mimetypes/application-x-kicad-project.png -w $sz -h $sz --export-area-snap ./sources/light/icon_kicad${source_sz}.svg
inkscape -o ../resources/linux/icons/hicolor/$size/mimetypes/application-x-kicad-pcb.png -w $sz -h $sz --export-area-snap ./sources/light/icon_pcbnew${source_sz}.svg
inkscape -o ../resources/linux/icons/hicolor/$size/mimetypes/application-x-kicad-schematic.png -w $sz -h $sz --export-area-snap ./sources/light/icon_eeschema${source_sz}.svg
for icon in $ICON
do
inkscape -o ../resources/linux/icons/hicolor/$size/apps/$icon.png -w $sz -h $sz --export-area-snap ./sources/light/icon_${icon}${source_sz}.svg
done
inkscape -o ../resources/linux/icons-nightly/hicolor/$size/apps/kicad.png -w $sz -h $sz --export-area-snap ./sources/light/icon_kicad_nightly${source_sz}.svg
done