Home » Swift » How to tell Smart Invert in iOS 11 not to invert my app colors and detect if it is enabled?

How to tell Smart Invert in iOS 11 not to invert my app colors and detect if it is enabled?

Posted by: admin November 30, 2017 Leave a comment


iOS 11 has a new feature called “Smart Invert Colors”, and I want to take advantage of that in my app. I already have my own dark mode implemented in my app, so I’ll do the “color inversion” process myself when Smart Invert is enabled. What I want to know is:

  • How do I tell iOS 11 that the app has a dark interface and don’t invert colours, similar to the iOS Clock app in iOS 10+?
  • How do I detect which kind of Invert Colors, specifically “Smart Invert” or “Classic Invert”, is enabled?

I’ve searched everywhere at Google, StackOverflow, and Apple Developer Website for some time now and still couldn’t find the answer.

Thanks in advance!


Just in case someone misunderstood me, I already know that UIAccessibilityIsInvertColorsEnabled() can be used to detect if invert colors is enabled, but that doesn’t let me see which kind of invert colors is enabled. Any ideas?

As for the other problem, I still couldn’t figure out how to tell Invert Colors not to invert my app in iOS 11. Any help would be appreciated. Thanks!

Update 2:

I noticed that emojis (?) are inverted in colors after using Smart Invert, which is one of the “main features” of the app. This doesn’t appear to happen in the iOS 11 Clock app when I enter in emojis, meaning Clock somehow told iOS 11 that the entire app doesn’t need to be inverted. I’m wondering how to do the same thing to my app. Thanks in advance for any help!

Update 3:

Thanks to @Toma’s answer, I successfully managed to prevent iOS 11 from inverting views in my app. Now I have another problem…

For the detection part, it appears that UIAccessibilityIsInvertColorsEnabled() will only return true if Smart Invert is on (iOS 11). At least I know it only works with Smart Invert for now. I’m now wondering how to find out when Classic Invert is on. Post an updated answer below if you know how to do so! Thanks!


See iOS 11 UIView‘s property accessibilityIgnoresInvertColors.