I have a fullscreen program (written in Python / Tkinter if this matters) which is displayed 24h/24 on a typical monitor. I would like to use correct colors (correct = physiological) to move from a daylight display to a night one. This is partly inspired by f.lux and partly by night modes in various devices.

My questions:

  • Is there a commonly accepted algorithm to smoothly change colors during dusk and dawn? (I mean here the kind of colors to go though, rather than how to code it)
  • What are the best choices for the day and the night colors? (this is obviously a matter of taste but I am sure there is consensus on the subject)

I realize that this is a question at the edge of software development and UX design. Feel free to close the question if it is too far-off.

  • 1
    I would look at one of the programming-oriented SE sites for the algorithm and the graphic design SE for color aesthetics – Charles Wesley Dec 14 '13 at 15:03

As the suns rays go through a larger and larger block of atmosphere (ie sunset) they get red-scattered meaning the light interacts with particles and perceived color becomes redder as a result of the blue light being scattered out by a larger number of interactions with the atmosphere leaving only the red light, fading from blue through yellow to red. This "Rayleigh scattering" is inversely proportional to the wavelength so longer wavelengths (redder light) are less scattered and filtered out than shorter, bluer wavelengths.

At the same time the intensity of illumination at the top of the sky diminishes , fading from blue to black.

On top of all this as the sun moves through an arc in the sky and specifically as it decreases elevation above the horizon and thus the rays go through more atmosphere relative to the observer, the light again gets shifted toward the red (ie longer wavelengths lower frequencies), moving from blue to pale yellow as the sub drops.

So there are a few things occurring, and the dominant things are :

  • color temperature moves through the visible spectrum from blue to red.
  • light intensity diminishes

If you combine these two effects, with other things such as stars fading in and twinkling, the sun moving, street or building lights coming on, a cat walking along a wooden fence, the sound of insects, you will definitely have something recognisable around the world as Sunset

  • 1
    Can I have this effect as a screensaver please ? :-) – PhillipW Dec 14 '13 at 20:47
  • Potential market interest is noted @PhillipW, that's all I'm going to do for now! :) – Cris Dec 16 '13 at 20:31
  • Thanks for the ideas -- I ended up going linearly between the colors you mentionned. As a side note: the wavelength of the light do not become longer as it is scattered, only the blue ones remain (wavelength changes in the Doppler effect) – WoJ Dec 18 '13 at 11:25
  • You are correct. Thanks for correcting that. I read more here under Rayleigh scattering : en.wikipedia.org/wiki/Elastic_scattering – Cris Dec 18 '13 at 17:03
  • I thought the reason was fluorescence, where wavelength is also modified by absorption then emission. Actually, the color of light in the sky is due to scattering. – Cris Dec 18 '13 at 17:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.