Adding Colour to macOS Folder Icons

The other day I saw this tweet:

Screenshot of the linked Tweet, showing macOS folders with colour-coded icons on the dock.

I use a PARA method-derived folder scheme, so I thought colour-coding the folders would be neat. But I was disappointed to find this isn’t a native macOS feature. The OP made the icons with Figma which seems very labour-intensive. Can we do better?

The default macOS folder icon is here:

/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericFolderIcon.icns

This is an ICNS file, an archive of PNG images. Using iconutil you can explode t:

$ iconutil -c iconset GenericFolderIcon.icns

This creates a GenericFolderIcon.iconset directory with these contents:

icon_128x128.png
icon_128x128@2x.png
icon_16x16.png
icon_16x16@2x.png
icon_256x256.png
icon_256x256@2x.png
icon_32x32.png
icon_32x32@2x.png
icon_512x512.png
icon_512x512@2x.png

And with ImageMagick you can apply colour changes. I experimented with a few options, the hardest parts are getting away from the initial blue bias, and preserving the drop shadow. This works somewhat:

$ magick default.png -modulate 100,0,100 -fill '#ef4444' -colorize 70 red.png

Turning this:

The default macOS folder icon: a folder with a blue tint.

Into this:

A red-tinted version of the default macOS folder icon.

If you this for each PNG in the iconset, the dual command:

$ iconutil -c icns Icon.iconset

Will turn the Icon.iconset folder into an ICNS folder Icon.icns.

Okay, so we have the existence proof that we can make a tolerable icon, and we know the mechanics of ICNS -> List[PNG] -> ICNS. Now we have to scale this up.

I started out with a Makefile, but make is really only tractable if you hardcode the dependency DAG. If you want to derive the DAG from a data structure (e.g., the colour palette) the code quickly becomes write-only.

Fortunately I have a Python interpreter, and an infinitely-industrious alien buddy who turns natural language into code. So I had Claude write a Python script that generates a tinted ICNS file for each colour in the Tailwind colour palette. And this is the result:

A screenshot of the Finder app, showing the script's output folder, with many different colour-tinted variants of the macOS default folder icon.

Which I think is pretty good for a half hour project. The code is here.

This is great example of how LLMs reduce the activation energy for tiny projects like this. Without Claude, I probably would not have bothered writing the entire Python script from scratch.