Scattering is a phenomenon in which the color of the light from the sky is affected by the wavelength of the light and the size of the particles in the air.
Molecules and small particles in the atmosphere change the direction of light rays, causing them to scatter.
The sun is low on the horizon so sunlight passes through more air at sunset and sunrise than during the day.
If the path is long enough, blue and violet light scatters out of your line of sight while other colors continue on their way to your eyes. This is why sunsets are often red and orange.
Violet or purple have shorter wavelengths and are scattered more easily through the molecules in the air.