If you can find a good enough color gradient algorithm...

It's difficult to integrate the gradient steps (if not only two steps) with the drawing progress of the canvas. You need to map the dragged pixels with the steps.