Search code examples
iosuicolor

iOS: Check if "Darken Colours" is activated


Starting in iOS 7.1, Apple added a new feature called "Darken Colours" that, as it is expectable by the name darkens down the colour od UI-elements (Bar Button items, etc.)
Now, I'd like to darken down some other UI-elements in my app if the user has activated this feature.
Is there a possibility to check programmatically if this feature is enabled?

Thank you!


Solution

  • In the iOS 8 SDK, Apple added several functions for detecting whether Accessibility options are enabled. (UIKit Function Reference: Accessibility)

    Among them is one called UIAccessibilityDarkerSystemColorsEnabled

    Swift:

    func UIAccessibilityDarkerSystemColorsEnabled() -> Bool
    

    Objective-C:

    BOOL UIAccessibilityDarkerSystemColorsEnabled ( void );