So, what’s causing it? Well, there has been some debate about that. There are three main lines of thought, one being that is has something to do with neurons in your visual cortex. Another is that your brain tries to color-correct the world and gets a bit stuck, while a third is that it’s a sort of withdrawal symptom, in this case an absence of color.
There was a particularly interesting study done on it back in 1995. Researchers then examined a single patient, one who had experienced significant brain damage. According to the researchers, he was “able to see color but little else”.
After showing him red-and-green gratings (although he was not really able to notice the gratings), the patient still reported that the effect worked when using a black-and-white grating after. The researchers concluded that the effect thus was probably occurring within the visual cortex, or somewhere between the eye and the brain.
A thesis submitted by Julien Ciroux to Edinburgh University agreed with this. He wrote that “the processing mechanisms involved in the ME [McCollough effect] are mostly located in the primary visual cortex, even if the change in this early area of the visual system drives subsequent modification in the activity pattern of higher cortical areas.”
Some studies have looked into just how prevalent the effect is. One way back in 1969 found that various stripes colored red and green produced the after-effects. Weirdly, it found that if your induction image was green, then you’d see red colors on vertical grates and green colors on horizontal grates. If a red induction image was used, then those colors reversed.
What’s weirder, it was only green and red that worked. “Colors near pure blue and pure yellow, which had little red or green content, produced weak aftereffects,” the study noted.. As far as we can tell, there isn’t a good explanation for why red and green are so good at producing the effect compared to others.
As for the grating thing? Well, that might be due to neurons in your visual cortex responding more strongly to their “preferred orientation and spatial frequency,” according to another study. It even suggested a rather interesting theory, that the JPEG image format used “plaid-like” (chequered) patterns, which are basically two gratings overlaid on each other.
“Perhaps the efficiency of this kind of representation means that something similar is also used by the visual system?” they wrote.
And that's kind of where we are now. It looks very much like the visual cortex is doing something, with your brain being tricked in one way or another. The exact mechanics behind it, though, are not completely understood. However, it does look like it’s very much a trick of the brain, and not a problem with our eyes themselves.