These gradually shade into yellow, green, blue, indigo, and violet. The colors have different wavelengths, frequencies, and energies. Violet has the shortest wavelength in the visible spectrum. That means that it also has the highest frequency and energy. Red has the longest wavelength, and lowest frequency and energy.
Light travels in a straight line as long as nothing disturbs it.
Then what happens to the light depends on the wavelength and the size of the thing it hits. Gas molecules are smaller than the wavelength of visible light. When light bumps into them, some of the light gets reflected, or bounces off the molecule, while the rest of the energy is absorbed by the molecule. While all colors are scattered by air molecules, violet and blue are scattered most. As you look at the horizon, the sky appears much paler in color.