MacOS Dark Mode

  1. 3 weeks ago

    Helge T

    Jun 4 Pre-Release Testers, Xojo Pro Europe (Oslo, Norway)

    Nice, wonder how this will work.

  2. Art G

    Jun 4 Prescott AZ

    I'm guessing it will work the same as the current General>Appearance setting does.

  3. Gavin S

    Jun 4 Pre-Release Testers, Xojo Pro UK
    Edited 3 weeks ago

    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.

  4. Christian S

    Jun 4 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    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.

  5. Dave S

    Jun 4 San Diego, California USA

    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

  6. Thom M

    Jun 4 Pre-Release Testers Greater Hartford Area, CT

    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.

  7. Emile S

    Jun 4 Europe (France, Strasbourg)

    What for ? Advantage(s) ?

  8. Sam R

    Jun 4 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

    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.

  9. Thom M

    Jun 4 Pre-Release Testers Greater Hartford Area, CT

    @Emile S What for ? Advantage(s) ?

    Because your users will expect it.

  10. Sam R

    Jun 4 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

    Here's the documentation on it.
    https://developer.apple.com/documentation/appkit/supporting_dark_mode_in_your_interface?language=objc

    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 :(

  11. Helge T

    Jun 5 Pre-Release Testers, Xojo Pro Europe (Oslo, Norway)

    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 ?

  12. Tomas J

    Jun 5 Pre-Release Testers, Xojo Pro Europe (Germany)

    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.

  13. Sam R

    Jun 5 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan
    Edited 3 weeks ago

    Apps linked against the macOS 10.14 SDK are assumed to support both appearance types unless they explicitly opt out.

    Boo!

    Seems like we can hard code which appearance to use, but not automatically obtain it (yet).

  14. Beatrix W

    Jun 5 Pre-Release Testers Europe (Germany)

    Christian to the rescue as usual?

    I'll still file this new feature under "things the world doesn't need".

  15. Sam R

    Jun 5 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

    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

    #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" ) )
    #endif

    However to get it to automatically adopt dark mode, is something that I'm still investigating.

  16. Gavin S

    Jun 5 Pre-Release Testers, Xojo Pro UK

    @Sam R 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.

    https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_app?language=objc

  17. Emile S

    Jun 5 Europe (France, Strasbourg)

    @Thom M Because your users will expect it.

    As a Xojo user, I expected so many things…

  18. Sam R

    Jun 5 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan
    Edited 3 weeks ago

    @Gavin S Xojo will need to link against the 10.14 SDK and that's it.

    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.

  19. Sascha S

    Jun 5 Pre-Release Testers, Xojo Pro Germany/W'haven

    @Sam R 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 :D

  20. Ulrich B

    Jun 5 Pre-Release Testers, Xojo Pro Europe (Germany, Berlin) · xo...

    @Sam R 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 :)

    Agreed. A renaissance for VisualEffectViews – which means it would be great to have (text) controls supporting Vibrancy …

  21. Newer ›

or Sign Up to reply!