├── .github └── screenshot.png ├── .gitignore ├── LICENSE.md ├── README.md ├── bin └── acextract ├── build.sh ├── build └── .gitkeep ├── custom └── .gitkeep └── symbols.txt /.github/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krestaino/macos-folder-icons/31a3b0eae8638dd6959aaf31e1de8a96f80cdf3b/.github/screenshot.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build/* 3 | !build/.gitkeep 4 | custom/* 5 | !custom/.gitkeep 6 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Kevin Restaino 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # macOS Folder Icons 2 | 3 | This script generates custom folder icons using images (SVG, PNG, etc) or [SF Symbols](https://developer.apple.com/sf-symbols/). The blank folder icon is extracted from your system, you may need to change the path location and file name depending on your OS version. This script targets macOS 12.x and 13.0. 4 | 5 | ![Screenshot](.github/screenshot.png) 6 | 7 | ## Requirements 8 | 9 | ImageMagick 7 10 | 11 | ## Getting Started 12 | 13 | 1. Download or clone the repo and open a terminal at the root of the project. 14 | 2. Place images in the [custom](custom) folder if you want to use SVGs or PNGs. 15 | 3. Copy symbols into the [symbols.txt](symbols.txt) file if you want to use [SF Symbols](https://developer.apple.com/sf-symbols/). 16 | 4. Run `./build.sh` to build the icons. 17 | 5. Icons are located in the [build](build) folder. 18 | 19 | ## Using Icons 20 | 21 | https://support.apple.com/en-gu/guide/mac-help/mchlp2313/mac 22 | 23 | ## Building on a different macOS version 24 | 25 | 1. Edit `ASSETS_LOCATION` to the appropriate path for your OS version. 26 | 2. Edit `DARK_FOLDER` and `LIGHT_FOLDER` to the appropriate file names of the extracted assets. 27 | 28 | ## Contributing 29 | 30 | Pull requests are welcome. I don't write Shell scripts much, so there's probably plenty of areas for improvement. A few things I'd like to add: 31 | 32 | - Automatically detect the OS version and set the correct asset path and folder file name. 33 | - Error handling. If this script fails, and you'll probably have no idea why. 34 | - Not including [acextract](https://github.com/bartoszj/acextract) in this repo. 35 | - Use something other than ImageMagick, it's quite slow if you build a lot of icons at once. 36 | - Building a web app so users can easily make icons from their browser. 37 | -------------------------------------------------------------------------------- /bin/acextract: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krestaino/macos-folder-icons/31a3b0eae8638dd6959aaf31e1de8a96f80cdf3b/bin/acextract -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Source: https://github.com/krestaino/macos-folder-icons 3 | 4 | # get flags 5 | while getopts 'f' flag; do 6 | case "${flag}" in 7 | f) NO_CACHE='true' ;; 8 | esac 9 | done 10 | 11 | # cleanup build 12 | rm -rf build/* 13 | 14 | # set theme 15 | THEME="system" 16 | echo "Building for $(tput setaf 4)$THEME$(tput sgr0) theme" 17 | 18 | DARK_FOLDER="FolderDark512x512@2x.png" 19 | LIGHT_FOLDER="Folder512x512@2x.png" 20 | 21 | if [ $THEME == "system" ]; then 22 | if [ "$(defaults read -g AppleInterfaceStyle)" == "Dark" ]; then 23 | THEME_FOLDER_FILE=$DARK_FOLDER 24 | else 25 | THEME_FOLDER_FILE=$LIGHT_FOLDER 26 | fi 27 | else 28 | if [ "$THEME" = "dark" ]; then 29 | THEME_FOLDER_FILE=$DARK_FOLDER 30 | else 31 | THEME_FOLDER_FILE=$LIGHT_FOLDER 32 | fi 33 | fi 34 | 35 | # extract blank folder from OS assets 36 | ASSETS_LOCATION="/System/Library/PrivateFrameworks/IconFoundation.framework/Versions/A/Resources/Assets.car" 37 | TMP=$TMPDIR/io.kmr.folderIcons 38 | FOLDER_ICON="$TMP/$THEME_FOLDER_FILE" 39 | 40 | # delete tmp if -f flag is set 41 | if [[ $NO_CACHE ]]; then 42 | rm -rf $TMP 43 | fi 44 | 45 | # extract blank folder 46 | if test -f "$FOLDER_ICON"; then 47 | echo "$(tput setaf 3)Blank folder already extracted, skipping...$(tput sgr0)" 48 | else 49 | echo "Extracting blank folder" 50 | ./bin/acextract -i $ASSETS_LOCATION -o $TMP > /dev/null 51 | fi 52 | 53 | # convert svgs 54 | echo "Converting custom icons" 55 | mogrify -density 2000 -resize x512 -background transparent -format png -path custom/ custom/*.svg 56 | 57 | # build custom icon folders 58 | echo "Building custom icons" 59 | for file in custom/*.png; do 60 | FILENAME=$(echo "$file" | cut -f 1 -d '.') 61 | BASENAME="$(BASENAME "$FILENAME")" 62 | 63 | convert $FOLDER_ICON \ 64 | \( -background transparent -size 512x512 -gravity center -geometry +0+40 $file -resize X340 -fill '#1ca1dd' -colorize 100% \) \ 65 | -compose over -composite "build/$BASENAME.png" 66 | done 67 | 68 | # build SF Pro icon folders 69 | echo "Building symbol icons" 70 | SYMBOLS=$(cat symbols.txt) 71 | 72 | for ((i = 0; i < ${#SYMBOLS}; i++)); do 73 | SYMBOL="${SYMBOLS:$i:1}" 74 | convert $FOLDER_ICON \ 75 | \( -background transparent -fill '#1ca1dd' -font SF-Pro-Text-Regular -size 512x512 -size X340 -gravity center -geometry +0+40 label:$SYMBOL \) \ 76 | -compose over -composite build/$SYMBOL.png 77 | done 78 | 79 | # build .icns 80 | echo "Building .icns files" 81 | for file in build/*.png; do 82 | FILENAME=$(echo "$file" | cut -f 1 -d '.') 83 | mkdir "$FILENAME.iconset" 84 | 85 | sips -z 16 16 "$FILENAME.png" --out "$FILENAME.iconset/icon_16x16.png" > /dev/null 86 | sips -z 32 32 "$FILENAME.png" --out "$FILENAME.iconset/icon_16x16@2x.png" > /dev/null 87 | sips -z 32 32 "$FILENAME.png" --out "$FILENAME.iconset/icon_32x32.png" > /dev/null 88 | sips -z 64 64 "$FILENAME.png" --out "$FILENAME.iconset/icon_32x32@2x.png" > /dev/null 89 | sips -z 128 128 "$FILENAME.png" --out "$FILENAME.iconset/icon_128x128.png" > /dev/null 90 | sips -z 256 256 "$FILENAME.png" --out "$FILENAME.iconset/icon_128x128@2x.png" > /dev/null 91 | sips -z 256 256 "$FILENAME.png" --out "$FILENAME.iconset/icon_256x256.png" > /dev/null 92 | sips -z 512 512 "$FILENAME.png" --out "$FILENAME.iconset/icon_256x256@2x.png" > /dev/null 93 | sips -z 512 512 "$FILENAME.png" --out "$FILENAME.iconset/icon_512x512.png" > /dev/null 94 | cp "$FILENAME.png" "$FILENAME.iconset/icon_512x512@2x.png" 95 | 96 | iconutil -c icns "$FILENAME.iconset" 97 | rm -R "$FILENAME.iconset" 98 | done 99 | 100 | # cleanup build 101 | rm -rf build/*.iconset build/*.png 102 | 103 | echo "$(tput setaf 2)Build complete!$(tput sgr0) Icons are located in the $(tput setaf 4)build$(tput sgr0) folder." 104 | -------------------------------------------------------------------------------- /build/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krestaino/macos-folder-icons/31a3b0eae8638dd6959aaf31e1de8a96f80cdf3b/build/.gitkeep -------------------------------------------------------------------------------- /custom/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krestaino/macos-folder-icons/31a3b0eae8638dd6959aaf31e1de8a96f80cdf3b/custom/.gitkeep -------------------------------------------------------------------------------- /symbols.txt: -------------------------------------------------------------------------------- 1 | 􀛸􀩼􀤑􀦇􀈑 --------------------------------------------------------------------------------