Is it possible to programmatically change the XDR Display Reference Mode (aka Preset) on macOS?

Viewed 143

Apple's XDR Displays like the Pro Display XDR and the Liquid Retina Display XDR support Display Reference Modes, also known as Presets. These can be changed from within System Preferences > Displays > Display Settings > Presets (After selecting an XDR Display).

Is there a way to get the list of available Presets and change the current Preset programmatically? Whether it's through a script or through an API? It seems like ColorSync is used to change/set a color profile but I don't see any reference for setting a preset within ColorSync.

Documentation for Reference Modes: https://support.apple.com/en-us/HT210435

1 Answers

If you haven't already succeeded another way you could start from these Applescript lines:

tell application "System Preferences" to activate
tell application "System Events"
    delay 0.2
    click button "Displays" of scroll area 1 of window "System Preferences" of application process "System Preferences"
end tell

Once you have done so (hopefully successful) move your cursor to the next button or pop-up-button, press Cmd-Shift-4 and:
 take a note of coordinates ([X], [Y]).
 put these into a new script tell application "System Events" to click at {[X], [Y]}.
   This script will in its "results" part show a definition of this (pop-up-) button (must be visible).
 append the definition after the first "click"-line (above) supplemented by click at the beginning (minus: of application "System Events") plus delay.
 Repeat these steps for every "level" of selections you need for your goal.
(I suggest you test the script after every appendix…)

Related