This phenomena is also called the Doppler shift. When the source of light is approaching towards an observer, the color tends to be blue shifted, but when the source is moving away or being stretch, the color tends to red shifted. In astronomy it can be use how fast galaxy is moving towards us or how fast it moves away.