Nice, wonder how this will work.
I’m guessing it will work the same as the current General>Appearance setting does.
I imagine it will work pretty much how the dark mode of the NSStatusItem works. If you make native apps with native controls, I imagine it will already support it. Of course, you may need to provide dark mode appropriate images for certain buttons (as with NSStatusItem).
This will reveal overnight who uses non-native stuff in their dev tools and apps.
You may need to provide black & white icons for toolbar, so system can invert them automatically.
But all custom drawn controls, may need a new switch in paint event to use different colors for dark mode.
done properly, all icons for iOS applications should be gray-scale masks, and rendered as “templates”, so you can use one image and display it as any color you wish.
I design all my iOS apps with a color template class, and the controls, views etc never refer to a “hard-coded” color
Haven’t looked into specifics yet, but I can tell you not to worry about your existing apps yet. Dark mode needs to be explicitly allowed by the app. Otherwise, it’ll show exactly as it does today.
What for ? Advantage(s) ?
Here’s how I imagine it to work. Exactly as ‘Dark Mode’ already works today, but with a system wide option, utilizing NSAppearance.
Which means that:
- Icons need to be ‘template’ NSImages.
- Some controls will need to be custom controls to be useable in the ‘Dark Mode’.
All of which can be done in native Xojo code.
In the current edition of http://xdevmag.com/ I have an article on going dark already. The second part will be in the next edition. I am planning to wipe my 2015 MacBook and install “Mojave” there so I can see if I need to make any changes to my article.
Because your users will expect it.
Here’s the documentation on it.
I’ll be taking a deeper look into in a moment (or many moments). Looks like there isn’t much to change, unless you’ve already enabled a dark mode, that is Or draw custom controls
Bummer, did a quick test, default desktop app. No dark mode… only grey as normal…
What do we have to do with Xojo to use dark mode ?
Helge, I guess without OS API calls it’s not possible by default now. But I am sure Xojo will implement this sooner or later giving you a higher level built-in switch for it. Would be cool feature if this would work cross-platform in Linux too.
Seems like we can hard code which appearance to use, but not automatically obtain it (yet).
Christian to the rescue as usual?
I’ll still file this new feature under “things the world doesn’t need”.
If you want to experiment with Dark Mode, add the following code to the open event of your application. Don’t forget to check and make sure that the app is running on 10.14 before you execute this code. THIS CODE WILL CRASH YOUR APPLICATION ON ANY OS VERSION BELOW 10.14
[code]#if targetMacOS then
declare function NSClassFromString lib “Cocoa” ( inClassName as CFStringRef ) as integer
declare sub setAppearance lib “Cocoa” selector “setAppearance:” ( NSApplicationInstance as integer, NSAppearanceInstance as integer )
declare function sharedApplication lib “Cocoa” selector “sharedApplication” ( classRef as integer ) as integer
declare function NSAppearanceNamed lib “Cocoa” selector “appearanceNamed:” ( NSAppearanceClass as integer, name as CFStringRef ) as integer
setAppearance( sharedApplication( NSClassFromString( “NSApplication” ) ), _
NSAppearanceNamed( NSClassFromString( “NSAppearance” ), “NSAppearanceNameDarkAqua” ) )
However to get it to automatically adopt dark mode, is something that I’m still investigating.
Xojo will need to link against the 10.14 SDK and that’s it. “Apps linked against the macOS 10.14 SDK are assumed to support both appearance types unless they explicitly opt out.” It’s automatic after that. Of course, there’s a ton of other work to do in our apps to properly support it but it’s basically automatic if using native controls. If you want your app to disallow it, you add a key/value to Info.plist.
As a Xojo user, I expected so many things
Yeah saw that earlier, I am fairly confident it ain’t going to happen anytime soon… I’m still waiting for them to link against 10.11 so I no longer get warnings about Metal
Beside apart form it not being automatic and some controls not working, it’s a heck of a lot nicer than the DarkVibrancyMode we had before. Far more consistent, & colorful too
Edit: I’m going to leave it for a while, the TextField issue might be a bug as there’s quite a few visual glitches still. On a lighter note, it’s already far more stable than any of betas of High Sierra, so that’s promising.
Can’t install because the Installer says my APFS Formatted drive can’t be APFS Formatted
Agreed. A renaissance for VisualEffectViews which means it would be great to have (text) controls supporting Vibrancy