Allow status icons on macOS to adapt to light / dark mode
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 829
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 40
Description
### What is the problem or limitation you are having?
Menu bar icons on macOS should adapt with dark / light mode. This fits in with menu bar icons provided by the OS and most macOS apps. It also allows developers to use a black or white menu bar icon which would otherwise be almost invisible in dark or light mode, respectively.
### Describe the solution you'd like
On macOS, icons automatically adapt to their surroundings when setting `template = true` on the NSImage. See https://developer.apple.com/documentation/appkit/nsimage/1520017-template.
We should make `template: bool` a general argument to `toga.Icon` for all platforms that support it. This would allow icons to be used more flexibly as templates and fit in more naturally in many environments besides the menu bar.
### Describe alternatives you've considered
We always set this flag in the toga-cocoa StatusIcon implementation. While macOS does allow colored menu bar icons, those are very uncommon.
### Additional context
_No response_
Contributor guide
Research direction
Start by tracing the toga.Icon API and the toga-cocoa StatusIcon implementation mentioned in the issue. Check how icon options are represented across supported platforms, then verify that the template behavior is applied where supported and that existing status icons remain compatible. Done means the general argument is documented and covered by the relevant platform tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, python
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100