Yes, if you have root access.
Tasker does not have the developer options built-in as something it can manage.
However, the developer options, like most preferences, are stored in a database behind the scenes. They can be modified via command-line, and Tasker is able to run shell commands. You just need to know what command to run.
Unfortunately, the catch is that you must have root access. While these settings can be changed via ADB without root, Tasker needs root to be able to run the same commands.
Determining Setting Key
To find out which option is needed, the easiest way is to list all preferences, change the preference, then list all preferences again. Then find the difference to determine the namespace and key which must be modified.
One easy way to do this is via ADB. On your desktop computer with Android Development Bridge installed, connect to your phone via adb shell
.
Run these three commands: settings list system
, settings list secure
, and settings list global
. After each one, copy the output into a new text file and save the files. Next, change your desired preference using your phone, and then run those 3 commands again, saving them into new text files.
Compare the files using diff
(on Linux) or any other utility designed to compare differences in text files. This will quickly show what changed from 'before' to 'after', letting you know which setting key was modified.
For this example, we find the specific setting is accessibility_display_daltonizer_enabled
in the namespace secure
. When it has a value of 1
, it's enabled, and the screen shows grayscale.
Creating a Grayscale Task
So back in Tasker, create a new Task called "Grayscale On". Add an Action, and go to Code -> Run Shell. The command to run is settings put secure accessibility_display_daltonizer_enabled 1
. Check the box that says Use Root
.
Clone that Task and call it "Grayscale Off". Modify the command to have a 0
at the end instead of a 1
.
Then, you can use Tasker however you like to run either of those tasks to turn grayscale mode on or off.