Mac Tray Icon Question
Jeremy Wood
mickleness at gmail.com
Wed Aug 10 02:12:57 UTC 2022
On Macs the tray can present black or white icons, depending on the
color of the desktop underneath the menubar.
For example:
Most icons switch from a black icon to a white icon as needed. A few 3rd
party app icons do not switch to a white icon against the black
background (for ex: Evernote). And interestingly: Apple’s Airdrop icon
(the concentric circles shaped like a sideways pacman) also appears to
do the wrong thing too.
Is there a way in a Java desktop app to set up a tray icon that can
toggle between white and black icons as needed?
Obviously we’d love it if this “just worked” without further
intervention by inverting our icon, but we’d also be happy if a solution
involved adding a PropertyChangeListener somewhere to identify the
menubar change and we could update the tray icons ourselves.
For ex:
If I change the highlight/accent color (in “System Preferences ->
General”), then 8 UIManager Colors change (including “textHighlight”,
“Button.light”, etc.) as of JDK 18. As far as I can tell: there is no
similar model to identify when the menubar changes colors.
For now we’ve made a work-around by using the Robot class to grab a
pixel from the Apple menu icon every few seconds to determine if it’s
light or dark.
Is there an existing way to resolve this we don’t know about?
Or if not: is anyone reading this with “author” status interested in
helping write this up as an openjdk bug?
Regards,
- Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20220810/084dbe07/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: galpmnvf.png
Type: image/png
Size: 12001 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20220810/084dbe07/galpmnvf.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qtqoidmn.png
Type: image/png
Size: 10952 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20220810/084dbe07/qtqoidmn.png>
More information about the client-libs-dev
mailing list