I have a React/TypeScript project, and I am trying to detect if a user has any of Mac OS's high contrast accessibility settings enabled: Invert colors, Use grayscale, Differentiate without color, Increase contrast, or an increased Display contrast setting.
I want to detect these using JavaScript/TypeScript.
So far, I can detect only Invert colors.
How do I detect if a user has any of the other Mac OS accessibility settings enabled?
More information:
On your Mac, choose Apple menu > System Preferences, then click Accessibility . macOS accessibility features are grouped by category in the sidebar of the preference pane: Vision: Use these features to zoom in on the screen, make the pointer or menu bar bigger, apply color filters, and more.
Drag the slider to increase or decrease the screen contrast. To quickly turn Invert Colors, Increase Contrast, and Reduce Transparency on or off using the Accessibility Shortcuts panel, press Option-Command-F5 (or if your Mac or Magic Keyboard has Touch ID, quickly press Touch ID three times).
High contrast mode is an accessibility feature that alters the colors used by the OS, apps, and websites to maximize legibility. It's popular among people with low vision or photosensitivity.
Iam afraid it is not possible its at this moment.
The feature in Objective-C to determine if the accessibility mode is active (boolean AXAPIEnabled(void);) has been deprecated as of 10.9 with no indication that there is a replacement. You can see it on the Apple Developer site. By extension, if developers at that level of the system no longer have access, I expect web developers would also be restricted (just as AppleScript writers seem to not have access).
In general, testing for the presence of assistive technology or activation of assistive features is frowned upon by the users who need it most. It creates the very real risk of both well-intentioned developers breaking these features (perhaps by un-verting the page) and also of allowing bad actors to determine somebody's personal health information.
Altought it might come in future as its in stage 5 (proposal) https://drafts.csswg.org/mediaqueries-5/#prefers-contrast
Other than that Iam afraid you are facing dead end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With