The McCollough effect (ME) refers to the phenomenon that, after a few minutes' exposure to gratings differing in both orientation and colour, subjects perceive similarly oriented achromatic gratings as if they were tinted with complementary hues. The traditional explanation of the ME as an adaptation of detectors selective for colour and orientation suffers from a number of inconsistencies: (i) the ME lasts much longer than ordinary adaptation, the decay of the effect being completely arrested during a night's sleep, or by occluding the eye for a long time; (ii) the strength of the ME is practically independent of the intensity of the adapting light; and (iii) a set of related pattern-contingent aftereffects discovered later would require, for explanation on similar lines, new detectors specific to other patterns. These properties can be explained, however, in the framework of associative memory and novelty filters. A computational model has been developed which consists of (i) an input layer of two (left and right eyes) square matrices with two analog receptors (red and green) in each pixel; (ii) an isomorphic associative neural layer, each neuron being synaptically connected with all receptors of both eyes; and (iii) an output layer (novelty filter). Modification of synaptic efficacies conforms to the Hebb learning rule. After a few presentations of coloured gratings the model displays the ME, which is slowly destroyed by subsequent presentations of random pictures. With a sufficiently large receptor matrix the effect lasts a thousand times longer than the period of learning. Continuous darkness does not change the strength of the effect. Like the real ME, the model does not display interocular transfer, but with other adapting patterns it shows the disparity-contingent colour aftereffect (thus confirming the connections with both eyes). The model can account for different pattern-contingent colour aftereffects without assuming any predetermined specific detectors. Such detectors are constructed in the course of adaptation to specific stimuli (gratings).