The blue hour occurs when the Sun is far enough below the horizon so that the sunlight's blue wavelengths dominate due to the Chappuis absorption caused by ozone.