Dark Mode iOSView background color

So, we were completely unprepared for Dark Mode - I opened feedback #58912 hoping for an easy “use light mode colors for everything!” switch.

I was told instead to use Color Groups - OK, let’s take a look.

And… I’m completely gobsmacked. I seriously never knew I was this incompetent - I’m trying to figure out how to change the Dark Mode color for the background of the default iOSView in a new iOS project, and for the life of me I can’t figure out how!

Can anyone help me out here?

https://github.com/jkleroy/iOSDesignExtensions

In the iOSView open event:

me.SetbackgroundColorXC(aColor)

If you are going to support dark mode, make sure you pass a ColorGroup into that call so your view’s background color will switch between light and dark modes automatically.

@Jeremie Leroy Wow, that is… terrifyingly extensive. Hats off to the work put into that repo!

@Jason Tait Thanks for the tip!

ColorGroups are not automatic. You’ll should put that code into the AppearanceChanged event instead.

For more info, please come to my Dark Mode for iOS session at Xojo.Connect 2020 in Nashville.

ColorGroups are changing from light to dark automatically for me. And I thought that was the point, otherwise if you need to manually reassign the color in AppearanceChanged then why would you bother changing a fixed color setting into a ColorGroup with both light and dark colors?

One reason is so they’re reusable. More importantly, they’re designed to be cross-platform, you’d be able to make one called CorporateBlue, have a Single color as a fallback and a Dual color for platforms that support dark mode.

We want it to be as automatic as it can be, but there are some places where it’s out of our control.