When you take the Doppler effect into account, it turns out that the visible light emitted from a source moving away from Earth will appear to have a wavelength longer than it really has, that is, shifted toward the red end of the visible spectrum.
This is the only way we have of measuring whether a source of light is moving away from us, and how fast. We measure the wavelengths of its light, and measure how much longer they are than they should be.
The main trick in this whole process is: When you see the light from a star or a galaxy, how do you know what its wavelength should be ?
Redshift and blueshift describe how light shifts approaching shorter or longer wavelengths as objects in space (such as stars or galaxies) move closer or removed away from us. The knowledge is key to charting the universe's expansion. Visible light is a spectrum of colors, which is clear to anyone who has observed at a rainbow.