I suspect that it is an optical illusion, like the one you get if you stare at a white spot for a little while, then look away, and see a negative black spot. The last bit of the sun is red at sunset and when that disappears, you can sometimes see a color-negative green flash.
It is not an afterimage illusion. It is refraction.