iOS dark mode

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

iOS dark mode

Trevor DeVore via use-livecode
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?

--Andrew Bell


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: iOS dark mode

Trevor DeVore via use-livecode
On Wed, Dec 4, 2019 at 2:30 PM Andrew Bell via use-livecode <
[hidden email]> 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
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: iOS dark mode

Trevor DeVore via use-livecode
In reply to this post by Trevor DeVore via use-livecode
Thank you Trevor! Adding this to my info.plist opted out of Dark Mode:
<key>UIUserInterfaceStyle</key>
        <string>Light</string>

Apple's ominous note at the end of that article gives me the  
impression that before too long (iOS 14?) this override will get the  
app rejected:
"Supporting Dark Mode is strongly encouraged. Use the  
UIUserInterfaceStyle key to opt out only temporarily while you work on  
improvements to your app's Dark Mode support."

--Andrew Bell



> Date: Wed, 4 Dec 2019 14:46:10 -0600
> From: Trevor DeVore <[hidden email]>
> To: How to use LiveCode <[hidden email]>
> Subject: Re: iOS dark mode
>
> On Wed, Dec 4, 2019 at 2:30 PM Andrew Bell via use-livecode <
> [hidden email]> 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
>



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: iOS dark mode

Trevor DeVore via use-livecode
On Thu, Dec 5, 2019 at 2:58 PM Andrew Bell via use-livecode <
[hidden email]> wrote:

> Thank you Trevor! Adding this to my info.plist opted out of Dark Mode:
> <key>UIUserInterfaceStyle</key>
>         <string>Light</string>
>
> Apple's ominous note at the end of that article gives me the
> impression that before too long (iOS 14?) this override will get the
> app rejected:
> "Supporting Dark Mode is strongly encouraged. Use the
> UIUserInterfaceStyle key to opt out only temporarily while you work on
> improvements to your app's Dark Mode support."
>

I'm glad that solved the immediate problem. Looks like we will need access
to the settings from within LiveCode in the future though.

--
Trevor DeVore
ScreenSteps
www.screensteps.com
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode