Each galaxy gives off its own spectrum of light. The spectrum includes colors and thin black lines. The dark lines are caused by the elements in the sun absorbing some of the light the star emits. If you are comparing 2 stars, what would it mean if the colors were shifted to the right of the spectrum?

What would it mean if the colors were shifted to the left of the spectrum?

If the colors of a star's spectrum are shifted to the right, it means that the star is moving away from us. This shift, known as a "redshift," occurs because of the Doppler effect. As the star moves away, the wavelengths of light emitted by it become stretched, causing the colors to shift towards the longer wavelength red end of the spectrum. This is similar to the effect you hear when a car with a siren passes, and the pitch of the sound seems to decrease as it moves away from you.

On the other hand, if the colors of a star's spectrum are shifted to the left, it means that the star is moving towards us. This shift, known as a "blueshift," occurs because the wavelengths of light emitted by the star become compressed as it moves closer, causing the colors to shift towards the shorter wavelength blue end of the spectrum. This is analogously similar to the sound of a car's siren becoming higher-pitched as it approaches you.

By analyzing the shift in the colors of a star's spectrum, astronomers can determine whether a star is moving towards or away from us, and also calculate its speed of motion. This insight into the motion of stars is valuable in studying celestial objects, understanding cosmic expansion, and even detecting the presence of exoplanets.