Skip to content

Make it easy to use SF Symbols in macOS menu items #48909

@nikwen

Description

@nikwen

Preflight Checklist

Problem Description

In macOS Tahoe, menu items for context menus, tray icon menus, application menus, etc. can have icons next to them.

Image

Here are Apple's design docs for the feature: https://developer.apple.com/design/human-interface-guidelines/menus#Icons

It would be great if it was possible to show SF Symbol icons there in the right size and with the right settings in one line of code.

Based on my experimentation, I can replicate the native look by saving symbols from the SF Symbols app with the following settings:

  • Font: SF Pro
  • Font weight: Semibold
  • Rendering mode: Monochrome
  • Color: Black (100%)
  • Background: Default
  • Point size: 13
  • Symbol scale: Small

(Right-click the icon, select "Copy Image As…", then select PNG)

Then I load them using nativeImage.createFromPath(). This replicates the native look.

Proposed Solution

It would be great if there was a one-line solution to load an SF Symbol with the correct settings (see above) so that we can set it as menuItem.icon.

This work could build on #48203. It would need to extend that logic to load semibold icons.

Alternatives Considered

Alternatively, developers will need to save every image manually. This doesn't make sense.

Additional Information

CC @TheCommieAxolotl

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions