Is there any way to script Windows 10's "color filter" feature programmatically?

I'm trying to get Windows 10 to emulate the new "Digital Wellbeing" feature that Google released alongside Android 9. Basically it changes the screen to grey-scale at night-time to try and incentivize people to get off their phone and go to sleep.

When I learned of Windows 10's "color filter" feature (which also allows you to set the color profile to grey-scale), I thought scripting this might be easy, but I can't seem to find a way to do this in a script directly.

At the moment, I basically have it working by turning on the Win+Ctrl+C toggle hotkey, and have a scheduled task set to run an AutoHotkey script that essentially hits those keys to trigger the shortcut. This works ok, but I'd like to be able to leave the shortcut key disabled so I don't accidentally hit it, or have such an easy way to disable the feature (and weaken the "Digital Wellbeing" effect). Also, the script has no way to know what the state of the setting is. If it runs twice, it undoes itself. Currently I don't have the machine scripted to unset the feature, but if I created a task to do that, and I shut the machine off before the nightly trigger, it might go grey-scale in the morning.

My question is to ask if there is any way I might be able to explicitly set "color filter on", or "color filter off" directly (via PowerShell, Batch, VBS, whatever) that doesn't depend on the shortcut key, and preferably that doesn't toggle?


So I was trying the same thing and ended up using: https://zerowidthjoiner.net/negativescreen in Grayscale mode, which is easy to trigger programmatically.


Before I tried that, I ran into something interresting. I tried to set the registry entries to enable color filtering:

 [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Accessibility]
"Configuration"="colorfiltering"

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Accessibility\ATConfig]

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Accessibility\ATConfig\colorfiltering]
"Active"=dword:00000001
"FilterType"=dword:00000000

[HKEY_CURRENT_USER\Software\Microsoft\ColorFiltering]
"HotkeyEnabled"=dword:00000001
"Active"=dword:00000001
"FilterType"=dword:00000000

This doesn't work on its own, because the setting is not applied. Interestingly though when I triggered a UAC popup, the color filter would be applied. So by calling

powershell Start-Process cmd.exe -Verb RunAs

the setting could be applied programmatically. This solution is terrible though, since an actual UAC popup is generated.

But if anyone knows of another way to force a window redraw (or whatever happens when the UAC is opened) it should be possible to programmatically apply the changed setting.