macOS Mojave: Change app icon to match Dark/Light Mode
Asked Answered
Y

1

6

Is there a way to change my app icon dynamically when switching between Dark/Light Mode in macOS Mojave?

I wish to change the icon appearance to appear appropriately in system alerts and notifications.

Youngran answered 5/4, 2019 at 7:7 Comment(1)
The answer here: #52769374 may be of some use to you. The answer provided this link which has a lot of information on setting icons for different modes: developer.apple.com/documentation/appkit/images_and_pdf/…Jellicoe
B
0

It seems like your best bet is to handle the icon change yourself: listen to appearance change notifications, and update the icon accordingly.

To set the Dock icon:

  • The easiest way is to assign a NSImage to NSApp.applicationIconImage. However, this only works when the app is running, and the change is cleared when the app quits.
  • A more reliable way, that keeps working when the app is not running, is to use a dock tile plugin. The implementation is more involved, however, as you need to create and configure an additional target.
Balaklava answered 12/11, 2023 at 21:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.