(AppleScript+macOS) Maybe The Only Working Applescript For Toggling Grayscale And Inverting Colors On macOS Sierra In The World

THANK YOU SILESKY

Toggle Grayscale

tell application "System Preferences"
    activate
    set the current pane to pane id "com.apple.preference.universalaccess"
    delay 1 # needs time to open universal access
    tell application "System Events" to tell process "System Preferences" to tell window "Accessibility"
        tell scroll area 2 to tell table 1 to tell row 6 #open display preferences
            select
        end tell
        click checkbox "Use grayscale"
    end tell
end tell

tell application "System Preferences" to quit

# Sierra: System Preferences -> Accessibility -> Display -> Use grayscale

Invert Colors

tell application "System Preferences"
    activate
    set the current pane to pane id "com.apple.preference.universalaccess"
    delay 1 # needs time to open universal access
    tell application "System Events" to tell process "System Preferences" to tell window "Accessibility"
        tell scroll area 2 to tell table 1 to tell row 6 #open display preferences
            select
        end tell
        click checkbox "Invert colors"
    end tell
end tell

tell application "System Preferences" to quit

# Sierra: System Preferences -> Accessibility -> Display -> Invert colors

Aliases

Run them from the command line. Maybe make your screen black and white at night or invert colors for screencasts or working in sunligh.

alias togglegrayscale='osascript /Users/gcr/util/sspadtogglegrayscale.scpt'
alias invertcolors='osascript /Users/gcr/util/sspadtogglecolors.scpt'

Test Your Emacs Themes In Black And White On macOS

A hardware and operating system implementer, whom I can’t recall, once quipped that using color on computer monitors added no value and was in fact a waste of memory. Interesting. NeXT monitors started out grayscale, I wonder why.

Continue reading “Test Your Emacs Themes In Black And White On macOS”