the light emitted by the sun is made of all of the colors of the rainbow, however it looks white. light passing through a crystal with a peculiar shape separates it into it’s different colors.
light travels in waves, some shorter and some longer, but the wavelengths vary; that is, forming a spectrum if you will. all light moves straight unless obstructed in one of three ways: being bent, reflected or scattered. before reaching the surface of the earth, light emitted by the sun hits the earth’s atmosphere and gets scattered by hitting the various molecules that make up the the various atmospheric layers atop the earth’s surface.
of all the colors in the rainbow, blue light is scattered the most because it travels as shorter and smaller waves giving the sky it’s blue hue. this is why the sky is blue most of the time.