Skip to content

Instantly share code, notes, and snippets.

@remino
Last active September 1, 2024 21:33
Show Gist options
  • Save remino/9fee925c29cd5c254d389fb669f6c1fa to your computer and use it in GitHub Desktop.
Save remino/9fee925c29cd5c254d389fb669f6c1fa to your computer and use it in GitHub Desktop.
*
!.gitignore
!make-macos-folder-icns.sh
#!/bin/sh
# make-macos-folder-icns.sh
# by Rémino Rem <https://remino.net>, 2024-06-24
# Convert .png file sets into macOS .icns icon files.
#
# Export 'macOS Folder Icons (Community).zip' from Figma:
# https://www.figma.com/design/fMbYLvi41EGhxnO5IYDdRx/macOS-Folder-Icons-(Community)
# Save file in the same directory as this script.
set -e
cd "$(dirname "$0")"
[ -d "macOS Folder Icons (Community)" ] && rm -fr "macOS Folder Icons (Community)"
# unzip2dir required:
# https://github.com/remino/unzip2dir
unzip2dir "macOS Folder Icons (Community).zip"
cd "macOS Folder Icons (Community)"
# Deleting the original icons as they are not the corrent sizes for the .icns file
# and likely not needed anyway.
rm -fr "macos-folder-original"*
ls * | sed -E 's/[0-9].*//' | grep -E '^mac[a-z-]+$' | sort | uniq | while read dir
do
rename "s/^$dir/icon_/" "$dir"*
mkdir -p "$dir.iconset"
rm -fr icon_*-*.png
mv -v "icon_"*.* "$dir.iconset"
echo "$dir.icns"
iconutil -c icns -o "$dir.icns" "$dir.iconset"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment