As a planet moves away from an observer, the light wavelength is stretched so the light changes to get closer to the red end of the spectrum. As a planet moves towards the observer, the light wavelength is compressed so the light moves to the blue end of the spectrum