Skip to content

Commit

Permalink
Provide native icon.icns for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
dex4er committed Feb 9, 2025
1 parent 42983c0 commit 110e02b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ coverage/
dist/
node_modules/
out/
icon.iconset/

.yalc/

Expand Down
Binary file added freelens/build/icon.icns
Binary file not shown.
Binary file removed freelens/build/icon.png
Binary file not shown.
22 changes: 19 additions & 3 deletions freelens/build/icon.sh
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

0 comments on commit 110e02b

Please sign in to comment.