DarkMode changed question

  1. 6 months ago

    Beatrix W

    Dec 2 Pre-Release Testers Europe (Germany)

    How do I handle a change from Dark Mode to Light Mode or vice versa? Let's say I open my app in Light Mode and change the mode to Dark. Then the current window doesn't change appearance. All windows I open are in in the old mode. Did I miss anything or is this not supported, yet?

  2. Edited 6 months ago

    The dark mode change will only work on MacOS 10.14 Mojave.

    Technically when you enable the Dark Mode option (under Build Settings) in Xojo or add the below to your info.plist


    will tell the app to work with dark mode.

    If you set all your font colors to #000000 and background colors to #FFFFFF, the app will automatically switch between dark and light mode automatically.

    Under App, you can add an Event Handler "AppearanceChanged" for those controls which doesn't behave. However this will only handle when the user change the theme while running your app. So you need to also add the same codes to your Window Open Handler.

    For example

    If IsDarkMode Then
      window1.label1.TextColor = Color.green
      window1.label1.TextColor = Color.blue
    End If  
  3. Beatrix W

    Dec 2 Pre-Release Testers Europe (Germany)

    @Edwin Lau: of course, I'm talking about Mojave. The plist information isn't needed.

    I'm not asking about the colors but about the windows themselves. Sure I can change the colors. But the window doesn't change between Dark Mode and Light Mode when I change the mode in System Preferences.

    See the screenshot below: I started my app in Light Mode. Then I changed to Dark Mode. In the background System Preferences and even Xojo change to Dark Mode. How do I do this in my app? There is a lot of custom drawing. But at least the toolbar should change here.


  4. Start a new project and under the App settings tab, turn on the Enable Dark Mode and see if that app change when you switch between the two appearance.

    For the toolbar it should be automatic with that setting enabled. Basically it just inject the tag in the info.plist. without which it remains in the aqua appearance and not the dark or light appearance.

  5. Beatrix W

    Dec 2 Pre-Release Testers Europe (Germany)

    This is odd. For a one-window app the change between Dark and Light Mode works just fine. But in my app there is no change at all. Not even dialog boxes change their mode.

  6. Jürg O

    Dec 2 Pre-Release Testers, Xojo Pro
    Edited 6 months ago

    You aren‘t using a PreRelease version, are you?
    You‘re using 2018r3 and building a 64Bit app?
    And your PostBuild Scripts don‘t mess with Info.plist?

  7. Beatrix W

    Dec 2 Pre-Release Testers Europe (Germany)

    No prerelease version. Yes to 2018r3 and 64bit.

    I removed all PostBuild scripts and the mode change suddenly worked. Then I started to add back all scripts. The culprit seems to have been the very last one - a DoCommand "SaveFile". After removing the script and adding it back everything is now working as it should. Very very odd.

  8. Beatrix, I just downloaded the Mail Archiver X Trial and took a look at your info.plist. It appears that the following key is not found in the info.plist. I've added it and rerun your app and now it looks like this in Dark Appearance.


  9. Beatrix W

    Dec 2 Pre-Release Testers Europe (Germany)

    Dark Mode support is coming for the next version of my app. I've been working on and off in the last months on Dark Mode. But there was some sort of project corruption.

  10. Greg O

    Dec 2 Xojo Inc

    @Beatrix W @Edwin Lau: of course, I'm talking about Mojave. The plist information isn't needed.

    Actually... when building with 2018r3, that plist entry is required for dark mode.

  11. Beatrix W

    Dec 2 Pre-Release Testers Europe (Germany)

    Haven't done any builds, yet. But so far everything works fine in the debugger.

or Sign Up to reply!