Moving toward a source makes the light more bluish, and moving away makes it appear more red. Different colors happen because atoms have different sizes, different nuclear charges, and influences on each other when they are close together. Most of our knowledge of atoms comes from studying the light they produce. The element helium, named for the sun, was discovered on the sun by analyzing sunlight, before it was found on the earth. It was later found on the earth mixed in the methane gas in Texas oil wells.
Optics is the science of working with light.
A good example might be a set of ordinary eyeglasses. A bonus is the fact that ordinary glass is a good absorber of ultra-violet light, the cause of sunburn, and this helps protect your eyes from damage. Using the Hubble Telescope to gather the weak light from distant galaxies, separate it into its various colors, amplify it electronically, and broadcast it back to earth by satellite transmission, we can now study the universe in ways that were thought to be impossible a few decades ago.