iOS dark mode

Trevor DeVore lists at mangomultimedia.com
Wed Dec 4 15:46:10 EST 2019


On Wed, Dec 4, 2019 at 2:30 PM Andrew Bell via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Is there a way to determine if an iOS device has dark mode ("Dark
> Appearance") enabled from within a LiveCode app?
>
> The inherited default text color of a field is black, but is changed
> to white by the OS when this mode is enabled (on a white background in
> this case which makes it appear invisible). This seems to only affect
> native mobile text fields, but not LC text fields.
>
> There is a feature enhancement to support dark mode for macOS, but I
> didn't see any reports for iOS.
> https://quality.livecode.com/show_bug.cgi?id=22221
>
> I'm not asking for an engine change, just curious if there is a way to
> check this so I can code around it. Perhaps mergNotify?
>

I don't know of a way to check this from within LiveCode using existing
tools. There is an API for checking which is documented here:

https://developer.apple.com/documentation/uikit/uitraitcollection/1651063-userinterfacestyle?language=objc

It should be possible to wrap that API using LiveCode Builder. From what
I've read, I think you also need to respond to a trailCollectionDidChange
message in case the user changes the setting while your app is open:

https://developer.apple.com/documentation/uikit/uitraitenvironment/1623516-traitcollectiondidchange?language=objc

The easier (temporary) solution would be to tell the OS to use light
appearance for your app. It looks like there is an Info.plist key that you
can add which will force your app to use the light appearance. Perhaps that
will help in your situation?

https://developer.apple.com/documentation/xcode/supporting_dark_mode_in_your_interface/choosing_a_specific_interface_style_for_your_ios_app?language=objc#3234550

-- 
Trevor DeVore
ScreenSteps
www.screensteps.com



More information about the use-livecode mailing list