qnoid
qnoid

Reputation: 2376

How to support the "increase contrast" option under the Accessibility > Display

macOS gives users a choice to "increase contrast".

increase contrast under accessibility display settings

I am trying to support this within a macOS app. Specifically, I want to adjust the fill of NSBox

What's the way to do it?

Update

There is a NSWorkspace.accessibilityDisplayOptionsDidChangeNotification notification however, it doesn't appear to fire.

Sample Project

Upvotes: 1

Views: 408

Answers (1)

Andriy
Andriy

Reputation: 2796

NSWorkspace.accessibilityDisplayOptionsDidChangeNotification fires when option changes. The only thing is, it fires in NSWorkspace's notification center. Not in the default one.

NSWorkspace.shared.notificationCenter.addObserver(self, selector: #selector(accessibilityDisplayOptionsDidChange(_:)), name: NSWorkspace.accessibilityDisplayOptionsDidChangeNotification, object: NSWorkspace.shared)

Then you have to use NSWorkspace.shared.accessibilityDisplayShouldIncreaseContrast property in your code to alter the appearance of your UI when necessary.

Upvotes: 1

Related Questions