blend filter and color
The blend filter ignores alpha from second input. You will need to recombine alpha component back into other components somehow. This one works for me:

ffmpeg -i a.png -f lavfi -i color=gray:s=512x512,format=gbrp -i b.png -lavfi "[1][2]overlay=format=gbrp[a],[0:v][a]blend=all_mode=overlay" out.png