0

How programmatically get value of Increase contrast setting on macOS Hight Sierra? Also interesting to know how to observe that value change.

Full path to system preference is System Preferences -> Accessibility -> Display -> Increase contrast.

enter image description here

On macOS Mojave it can be achieved via effectiveAppearance.bestMatch API call like below.

open override func layout() {
  super.layout()
  if #available(OSX 10.14, *) {
     if let value = effectiveAppearance.bestMatch(from: [.aqua, .darkAqua, .accessibilityHighContrastAqua, .accessibilityHighContrastDarkAqua]) {

        switch value {
        case .aqua:
           setupAppearance(.light)
        case .darkAqua:
           setupAppearance(.dark)
        case .accessibilityHighContrastAqua:
           setupAppearance(.highContrastLight)
        case .accessibilityHighContrastDarkAqua:
           setupAppearance(.highContrastDark)
        default:
           break
        }

     }
  }
}
Vlad
  • 6,402
  • 1
  • 60
  • 74

1 Answers1

1

Starting on macOS 10.10 you can use this API of NSWorkspace.

https://developer.apple.com/documentation/appkit/nsworkspace/1526290-accessibilitydisplayshouldincrea

DR.
  • 36
  • 1