You achieve this in the exact same way wether you show colored or grayscale version first. In fact, you don't even need to use two versions of the same image. You might just as well have one image of a ball and one of a guitar...
The only thing you'd change is which image is set as background for the anchor element and which is used as src for the image element.