Using your Mac after sunset may be keeping you up. Even at its dimmest setting, the kind of light given off by its LED display can affect your ability to fall asleep. Changing the warmth or color temperature may help and there’s free software that can do it automatically, called F.lux.

A lot of science has gone into the study of sleep, most likely because there are a lot of us not getting any. It could be that we’re not getting enough sleep, or it takes too long to fall asleep, or we can’t stay asleep. Maybe the sleep just isn’t restful. We go to great lengths for a good night’s sleep from simple ear plugs and eye-masks, to expensive mattresses, sleeping pills and even breathing machines.

What the latest science is learning, however, is that our electronic devices may be keeping us up, and it’s not because we can’t get past the next level in Angry Birds. The prime suspect they’re investigating is the light from electronic displays: specifically the blue wavelengths generated by today’s flat-panel LED displays. Our Macs use them. iPads, iPods and iPhones use them. Think about it: That’s hundreds of millions of devices capable of disrupting normal, healthy sleep!

Turns out those blue wavelengths of LED light do a great job of simulating daylight, much better, in fact than fluorescent light, regular incandescent light or the original artificial light, fire. Go back as far as you care to in human evolution, and you’ll find that we’ve never been exposed to this much convincing daylight after sunset.

A few developers have come up with a free (and patent pending) method of addressing this, called F.lux, a free download. Available for OS X PPC/Intel (and compatible with Lion) as well as Linux and Windows, F.lux runs in the background and adjusts the color temperature (red or blue) of your display depending on the time of day and your location. As the sun sets wherever you are, F.lux warms up the color of your display, gradually removing the blue wavelengths.

The F.lux preferences window

F.lux lives in your menu bar. Tell F.lux how you’d like your display to look night and day, then tell it where you are (It can use OS X Location Services). F.lux will then determine when sunrise and sunset is. You can transition quickly (20 seconds) or gradually (1 hour) and preview the results. There are also presets that match real-world lighting (tungsten, halogen, fluorescent and daylight).

For those of you that need to do color accurate work, you’ve not been forgotten. There’s a setting to disable F.lux for one hour at a time. The developer plans to add the ability to allow for automatic disabling of F.lux when using certain apps, so its auto-updating ability should ensure you get the new features as soon as they’re available.

Using F.lux, I’ve noticed that reading on my MacBook Pro before bed makes me tired the same way reading a book might. Perhaps it’s a placebo effect, but I don’t recall that happening in the past. Watching videos when F.lux is active hasn’t been an issue for me, but again, you can easily disable it an hour at a time.

Now, don’t go pulling out your iPad or iPhone and potentially ruining a good night’s sleep…until there’s an app for that.