desktopToDarwinBundle: support 48x48 icons

This commit is contained in:
Randy Eckenrode 2022-03-01 21:59:22 -05:00
parent 1f59c76c66
commit d2748e84f8
No known key found for this signature in database
GPG key ID: 64C1CD4EC2A600D9

View file

@ -18,7 +18,7 @@ convertIconTheme() {
local -r iconName=$3
local -r theme=${4:-hicolor}
local -ra iconSizes=(16 32 128 256 512)
local -ra iconSizes=(16 32 48 128 256 512)
local -ra scales=([1]="" [2]="@2")
# Based loosely on the algorithm at:
@ -31,6 +31,13 @@ convertIconTheme() {
local scaleSuffix=${scales[$scale]}
local exactSize=${iconSize}x${iconSize}${scaleSuffix}
if [[ $exactSize = '48x48@2' ]]; then
# macOS does not support a 2x scale variant of 48x48 icons
# See: https://en.wikipedia.org/wiki/Apple_Icon_Image_format#Icon_types
echo "unsupported"
return 0
fi
local -a validSizes=(
${exactSize}
$(expr $iconSize + 1)x$(expr $iconSize + 1)${scaleSuffix}
@ -121,6 +128,8 @@ convertIconTheme() {
scalable)
synthesizeIcon "${scalableIcon[0]}" "$result" "$iconSize" "$scale" || true
;;
*)
;;
esac
done
done