It's all to do with our cone cells, one of the two types of photoreceptors within our eye's retina, which are responsible for color vision. We have three types of cones, which are sensitive to blue, green or red wavelengths of light. When we're exposed to a lot of one color, that particular type of cone gets overstimulated and becomes "tired" and unresponsive. This leaves you temporarily with the use of only your other two types of cone, which show the opposing "complementary" color (i.e red versus green and blue versus yellow). After a few seconds, the cones "recharge" and you're able to perceive that color again.