Skip to content

fix(macos): Enable template mode for menu bar tray icon - #175

Merged
mattdjenkinson merged 1 commit into
mainfrom
fix/macos-tray-icon-template
Aug 21, 2026
Merged

fix(macos): Enable template mode for menu bar tray icon#175
mattdjenkinson merged 1 commit into
mainfrom
fix/macos-tray-icon-template

Conversation

@mattdjenkinson

@mattdjenkinson mattdjenkinson commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

On macOS, the Datum tray icon stayed white while neighboring menu bar icons switched between light and dark tints. We already ship a monochrome PNG named for template use, but never told AppKit to treat it as one. Without NSImage.isTemplate, the system draws the pixels literally instead of adapting them to the menu bar background.

This sets with_icon_as_template(true) on the TrayIconBuilder for macOS builds. macOS then uses the icon's alpha channel as a mask and picks the right foreground color for light menu bars, dark menu bars, and highlighted states. No second asset or appearance polling required.

Test plan

  • Build and run Datum on macOS
  • Light menu bar (light wallpaper): tray icon appears dark like system icons
  • Dark menu bar: tray icon appears light
  • Click the tray icon: highlight state looks correct
  • System Settings → Accessibility → Display → Reduce transparency: icon readable on solid gray menu bar
  • Tray context menu and recent tunnel items unchanged

The tray PNG was loaded as a literal white bitmap, so it stayed white
when other menu bar icons adapted to light and dark backgrounds. Set
NSImage template mode via tray-icon's builder API so macOS tints it.
@mattdjenkinson
mattdjenkinson marked this pull request as ready for review August 21, 2026 12:30
@mattdjenkinson
mattdjenkinson requested a review from savme August 21, 2026 12:30
@mattdjenkinson mattdjenkinson self-assigned this Aug 21, 2026

@drewr drewr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right!

@mattdjenkinson
mattdjenkinson merged commit 2b757d5 into main Aug 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants