Skip to content

Instantly share code, notes, and snippets.

@standyro
Created March 17, 2015 01:33
Show Gist options
  • Select an option

  • Save standyro/c49be8f53c08df100ef7 to your computer and use it in GitHub Desktop.

Select an option

Save standyro/c49be8f53c08df100ef7 to your computer and use it in GitHub Desktop.
Change Blue Tint of Icons in Mac Yosemite
#!/bin/bash
# List of system icons which need to be changed
sys_icons="ApplicationsFolderIcon.icns BurnableFolderIcon.icns \
DesktopFolderIcon.icns DeveloperFolderIcon.icns DocumentsFolderIcon.icns \
DownloadsFolder.icns GenericFolderIcon.icns GenericSharepoint.icns \
GroupFolder.icns LibraryFolderIcon.icns MovieFolderIcon.icns \
MusicFolderIcon.icns OpenFolderIcon.icns PicturesFolderIcon.icns \
PublicFolderIcon.icns ServerApplicationsFolderIcon.icns \
SitesFolderIcon.icns SystemFolderIcon.icns UsersFolderIcon.icns \
UtilitiesFolder.icns"
# Back up CoreTypes.bundle just in case and copy the icons to ~/folder_icons
cp -r /System/Library/CoreServices/CoreTypes.bundle ~/CoreTypes_BACKUP.bundle
mkdir ~/folder_icons
cd /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources
cp $sys_icons ~/folder_icons
# List of dropbox icons which need to be changed
dropbox_icons="DropboxFolderIconYosemite.icns DropboxAppFolderIconYosemite.icns \
DropboxPublicFolderIconYosemite.icns DropboxReadOnlySharedFolderIconYosemite.icns"
# Check if yosemite-ready dropbox is installed and copy the dropbox icons to ~/folder_icons
if [ -f "/Applications/Dropbox.app/Contents/Resources/DropboxFolderIconYosemite.icns" ]; then
cd /Applications/Dropbox.app/Contents/Resources
cp $dropbox_icons ~/folder_icons
fi
cd ~/folder_icons
# Change ownership of icns files to user
sudo chown `whoami` $sys_icons $dropbox_icons &> /dev/null
# Convert icns files to "iconset" folders containing png files
for icon in *.icns; do iconutil -c iconset "$icon"; done
# Use imagemagick to adjust saturation (-20%) and hue (+2%)
for icon in ./**/*.png; do mogrify -modulate 100,80,102 "$icon"; done
# Convert "iconset" folders back to icns files
for icon in *.iconset; do iconutil -c icns "$icon"; done
# Copy the modified system and dropbox icons back to their original bundles
sudo cp $sys_icons /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources
if [ -f "DropboxFolderIconYosemite.icns" ]; then
cp $dropbox_icons /Applications/Dropbox.app/Contents/Resources
fi
# Set owner/group to root/wheel and delete extended attributes
cd /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources
sudo chown root $sys_icons
sudo chgrp wheel $sys_icons
sudo xattr -d com.apple.quarantine $sys_icons &> /dev/null
# Delete icon cache (restart necessary)
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; &> /dev/null
sudo find /private/var/folders/ -name com.apple.iconservices -exec rm -rf {} \; &> /dev/null
# Remove working directory
rm -rf ~/folder_icons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment