10.10 Darkmode detection

Is there a good way to detect if Yosmite is running in dark mode or not?

The gist of things is that you shouldn’t be changing your application’s depending on the light vs dark theme (and therefore not need to detect it). See Apple employee taylor_kelly’s posts on this devforum post: How to detect Dark Theme ?

Doesn’t the plugin I emailed you show you?

NSAppearanceMBS class can do that, I bet.

and isn’t 10.10 still under NDA?

There are public betas this time.

Yes, but when using a status item icon it seems you need a light and dark version.
Or am I missing something?

There is indeed still one thing one may need to change is the icon you use for a menu let in the menubar. I tried with some of my app and by default the icon can be barely visible
From what I read, NSstatusitem template need to be set to yes (setTemplate:yes).
I think there is a way with MBS plug-in to do this easily.
see Update NSStatusItem setup to work with Yosemite’s dark mode
and How to detect dark mode in Yosemite to change the status bar menu icon

https://forum.xojo.com/13422-yosemite/p1#p106077

If you use MBS plugins:
NSImageMBS.isTemplate=true seems to fix the NSStatusItem issue in Dark mode.

Cool :slight_smile:

[quote=127822:@Christoph De Vocht]Yes, but when using a status item icon it seems you need a light and dark version.
Or am I missing something?[/quote]
The Apple employee said you don’t. Using a template icon (vector pdf) would automatically make the appropriate transformation, and doing it any other way will display wrong on inactive menubars.

Mr Parnell speaks the truth.

Never really was, except for not being allowed to post screen shots.

Can confirm the Template attribute does work. If you’re using macoslib the code is as simple as:

dim AppStatusItemIcon as new NSImage(image_resource) AppStatusItemIcon.Template = True