The ghostly colored images you see, called afterimages, are the result of adaptation in the color-sensitive cells in your eyes.
There are three types of color-sensitive cone cells in your eyes; each responds to reddish, greenish, or bluish light. When you stare at the red parrot, your red-sensitive cones “get used to” the image and stop responding as strongly. When you suddenly look at a white background, the relatively strong response of your blue and green cones produces an image of a blue-green parrot.
Similarly, staring at a blue-green parrot will produce an image of a red parrot. In general, staring at any color will produce an afterimage that is that color’s complement, or opposite.