The photo above showing a colorful contrail, was captured high over Murrieta, California on August 3, 2013. The pastel colors are a result of diffraction — sunlight is deflected by minute droplets that compose the contrail. Image © Mark Ritter; Mark’s Web page. with permission.
This occurs when the contrail, or more often a cloud, is in the vicinity of Sun. As the contrail extend further from the jet, and in this case from the Sun‘s position, the colors disappear. Note the jet’s shadow, to the immediate left of the jet, cast on a thin layer of clouds below it.