Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AppIconReverser

This is a hastily-made app designed to reverse-engineer macOS icon metrics.

Why?

Starting in macOS 26, app icons are no longer simple images. Developers are required to create icons with Icon Composer and then have Xcode generate various image assets at compile time. This does not work if your application is running within another app (such as "Python.app") – your app icon will always be the one specified by the parent.

The only way to change your app icon is -[NSApplication setApplicationIconImage:]. This API does not automatically apply any kind of styling – it's up to you to mimic the appearance of the system icons.

Exporting Background Files

It's extremely difficult to reproduce the background gradient and inner shadow effect in code. For matplotlib Issue 31895, we generate macos_appicon_darkbg26.png and macos_appicon_darkbg27.png and composite a transparent version of our logo on top of the opaque background.

Methodology

  1. Create a blank icon in Icon Composer.
  2. Launch app with blank icon.
  3. Call -[NSApplication applicationIconImage] to fetch the blank icon. Note that this has slightly different metrics than the embedded .icns files in the app bundle. As matplotlib uses -[NSApplication setApplicationIconImage:], these are the metrics that we need.
  4. Dilate/bleed the pixels surrounding the edge of the squircle. Search for "alpha bleeding", "color bleeding", "edge padding", "alpha dilation" to understand this problem.
  5. Save the result as an opaque PNG file.

Reversing Icon Metrics

  1. For best results, switch "Icon & widget style" to "Dark".
  2. Launch AppIconReverser.
  3. Use the "Exporter" window to export both a background image and a reference image. The Exporter will try to detect the length of the app icon squircle and default to an image (length + 2) pixels wide/high.
  4. Open the "Reverser" window. Drag the exported background image into "Content Image" and the exported reference image into "Reference Image".
  5. Change the view mode to "Diff (White, 8x)". Adjust the Squircle Length to remove as much darkness from the top of the squircle as possible. This should result in the same number as "Detected Length" during export:

    Tutorial Image 1
  6. Adjust Shadow Opacity and Shadow Blur to remove darkness from the sides of the squircle:

    Tutorial Image 2
  7. Adjust Shadow Offset to remove darkness from the bottom of the squircle:

    Tutorial Image 3
  8. Adjust Squircle Radius to remove darkness from the corners:

    Tutorial Image 4

Results

Best Metrics

macOS 11-15 macOS 26 - 27
Squircle Length 206 208
Squircle Radius 45.5 54.5
Shadow Opacity 30 25
Shadow Offset 3 3
Shadow Blur 3 4.8

License

The files in this repository are dedicated to the public domain.

SPDX-License-Identifier: CC0-1.0

About

App to reverse-engineer macOS app icon metrics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages