Rayleigh scattering
The blue colour of the sky results from Rayleigh scattering, as the size of the gas particles in the atmosphere is much smaller than the wavelength of visible light. Rayleigh scattering is much greater for blue light than for other colours due to its shorter wavelength. As sunlight passes through the atmosphere, its blue component is Rayleigh scattered strongly by atmospheric gases but the longer wavelength (e.g. red/yellow) components are not. The sunlight arriving directly from the Sun therefore appears to be slightly yellow, while the light scattered through rest of the sky appears blue. During sunrises and sunsets, the effect of Rayleigh scattering on the spectrum of the transmitted light is much greater due to the greater distance the light rays have to travel through the high-density air near the Earth's surface.