Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Easily toggling display's White Point (Accessibility)
-
Hi All,
I am hoping to use Pythonista to make a script with which I can easily change the display settings for my iPhone for the evenings. I don't care about Nightshift, it doesn't work for me. What works great on the other hand is setting the White Point to 100% (highly reducing the brightness of bright colours). So in short I'd like to create a little script that allows me to toggle the white point setting without always having to go to Settings > General > Accessibility > Display Accommodations.
I am not knowledgable at all in API's, Pythonista and programming, so I wouldn't know how to figure out if this is actually possible. So I am wondering if anyone here can point me in the right direction?
In my googles I have already looked at:
https://developer.apple.com/reference/uikit/uiaccessibilityMany thanks for your help!
Joachim -
Most likely it's not possible to control accessibility settings using Pythonista. Apple generally doesn't provide any APIs to change the user's settings, which is a very good thing, because it prevents apps from changing your settings to what they think is best. (The UIAccessibility APIs that you linked to are for providing accessibility support in your own app. It doesn't look like you can change any of the accessibility settings with them.)
It's possible that the accessibility settings could be changed using undocumented/private Objective-C APIs. That isn't a very good or easy solution though. Private frameworks are completely undocumented, so you have to guess what the frameworks, classes and methods do, based on their names (and you'll have to deal with lots of app crashes while testing). There's also no guarantee that these private APIs will continue to exist and work in future iOS versions, so your script may break after an iOS update.
-
I made this a while ago:
https://gist.github.com/omz/aca3f4877d3f565239d8
Video demo:
https://twitter.com/olemoritz/status/713104304366886916
Maybe it's a starting point for what you want to do. I should add that this is using completely unsupported, private API, and it might break anytime, but it still seems to work on iOS 10.3.
-
Thanks so much for both your replies!
To be honest, that code that seems great! I have no idea what most of the code is doing, but I can actually make the screen dimmer then necessary. Thanks very much, when I've made this into something useful for me, I'll post with an update :)
Now it's fingers crossed Apple doesn't break it!