Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic Toggle Grayscale on Mac OS Ventura

i got the following problem: i try to toggle the color filter grayscale automatically when using certain websites (to limit the use of those ;)). I tried several things, however I'm quite new to using Terminal, so that I basical have no clue what i'm doing wrong.

I found an explenation which did not work for me here (https://apple.stackexchange.com/questions/240446/how-to-enable-disable-grayscale-mode-in-accessibility-via-terminal-app?rq=1), however I'm not sure what I'm doing wrong.

I applied the following implementation:

I used the code below in MacOS Automator with the function "Run Apple Script". I gave the terminal as well as the automator the access to the accessibility features via the Security Settings. When using the script an error occures. It states (i had to translate it from Germany, thus the wording might be not 100% correct) „System Settings“ return an Erro: Error in the AppleEvent-Routine.

if running of application "System Preferences" then
    try
        tell application "System Preferences" to quit
    on error
        do shell script "killall 'System Preferences'"
    end try
end if

repeat while running of application "System Preferences" is true
    delay 0.01
end repeat

tell application "System Preferences" to reveal anchor "Seeing_Display" of ¬
    pane id "com.apple.preference.universalaccess"

tell application "System Events" to tell process "System Preferences"
    repeat until exists checkbox "Use grayscale" of group 1 of ¬
        window "Accessibility"
        delay 0.01
    end repeat
    click the checkbox "Use grayscale" of group 1 of window "Accessibility"
end tell

tell application "System Preferences" to quit

Thank you for helping me out.

Best

like image 319
KonstiR Avatar asked Oct 18 '25 13:10

KonstiR


1 Answers

First, manually go to

System Settings -> Accessibility -> display

and set the "Filter type" to Greyscale (you only have to do this once).

Second, go to

System Settings -> Accessibility -> Shortcut

and uncheck everything but "Colour Filters"

Once you have done that, here are 2 shortcuts that do what you want:

  1. option-command-F5
  2. quick-press fingerprint key 3 times.

[tested on macOS Sonoma, 14.2.1]

like image 96
A.G. Avatar answered Oct 20 '25 14:10

A.G.