-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
20 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ coverage/ | |
dist/ | ||
node_modules/ | ||
out/ | ||
icon.iconset/ | ||
|
||
.yalc/ | ||
|
||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
## macOS | ||
magick -background none icon.svg -density 300 -resize 408x408 -bordercolor transparent -border 52 -verbose icon.png | ||
rm -rf icon.iconset | ||
mkdir icon.iconset | ||
for i in 16 32 64 128 256 512 1024; do | ||
border=$(("${i}000" * 100 / 1000000)) | ||
size=$((i - 2 * border)) | ||
half=$((i / 2)) | ||
if [[ $i -ne 1024 ]]; then | ||
magick -background none icon.svg -density 400 -resize "${size}x${size}" -bordercolor transparent -border "${border}" -verbose "icon.iconset/icon_${i}x${i}.png" | ||
fi | ||
if [[ $i -ne 16 ]]; then | ||
magick -background none icon.svg -density 400 -resize "${size}x${size}" -bordercolor transparent -border "${border}" -verbose "icon.iconset/icon_${half}x${half}@2x.png" | ||
fi | ||
done | ||
iconutil --convert icns -o icon.icns icon.iconset | ||
rm -rf icon.iconset | ||
|
||
## Windows | ||
magick -background none icon.svg -define icon:auto-resize=256,16,20,24,32,40,48,60,64,72,80,96 -verbose icon.ico | ||
magick -background none icon.svg -density 400 -define icon:auto-resize=256,16,20,24,32,40,48,60,64,72,80,96 -verbose icon.ico | ||
|
||
## Linux | ||
for i in 16 22 24 32 36 48 64 72 96 128 192 256 512; do | ||
border=$(("${i}000" * 38 / 1000000)) | ||
size=$((i - 2 * border)) | ||
magick -background none icon.svg -density 300 -resize "${size}x${size}" -bordercolor transparent -border "${border}" -verbose "icons/${i}x${i}.png" | ||
magick -background none icon.svg -density 400 -resize "${size}x${size}" -bordercolor transparent -border "${border}" -verbose "icons/${i}x${i}.png" | ||
done |