On my Pixel using GrapheneOS, I can go into Accessibility settings and enable gesture support for toggling Grayscale support, without the need for Tasker. I'm unsure how other Android ROMs stack up but I imagine stock Pixel has this setting.
It's a great feature, just swipe up from the bottom with two fingers whenever I need color.