Last active
March 17, 2017 06:29
-
-
Save ty0x2333/8b27ef55465aec6bd77b6452b3d547f7 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# https://gist.github.com/luckytianyiyan/8b27ef55465aec6bd77b6452b3d547f7 | |
PATH=$PATH:/usr/local/bin | |
IFS=$'\n' | |
if [ ! $(command -v convert) ]; then | |
echo "❗️ convert command not found" | |
echo "brew install imagemagick" | |
exit 1 | |
fi | |
function generateIcon() { | |
BASE_IMAGE_NAME=$1 | |
LOGO_PATH="$METAL_LIBRARY_OUTPUT_DIR/$BASE_IMAGE_NAME" | |
if [ ! -f "$LOGO_PATH" ]; then | |
echo "❗️ logo not found: $LOGO_PATH" | |
return | |
fi | |
if [ "$EFFECTIVE_PLATFORM_NAME"x != "-iphonesimulator"x ]; then | |
LOGO_TEMP_PATH="${LOGO_PATH%.png}-back.png" | |
echo "🔨 fix icon $LOGO_PATH" | |
$PLATFORM_DEVELOPER_BIN_DIR/pngcrush -revert-iphone-optimizations -q $LOGO_PATH $LOGO_TEMP_PATH | |
mv $LOGO_TEMP_PATH $LOGO_PATH | |
fi | |
convert $LOGO_PATH -fill "#F29CB1" +opaque white $LOGO_PATH | |
echo "✅ converted" | |
echo "---" | |
} | |
if [ "$CONFIGURATION"x = "Debug"x ]; then | |
echo -e "⚠️ Debug model, convert icon..." | |
declare -a pngs=`ls $METAL_LIBRARY_OUTPUT_DIR | grep AppIcon` | |
for filename in $pngs; do | |
echo "📌 processing $filename" | |
generateIcon $filename | |
done | |
fi | |
IFS=$OLDIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment