i've recently started using f.lux [1], which adjusts the color temperature of the screen based on the time. after a night of coding, i've noticed i've been able to fall asleep more quickly, probably since my eyes adjust to the ambient warm light in the room while coding.
f.lux is great when it works, but if you plug into an external monitor at all, it seems to stop working automatically. I'd go three days and suddenly realise that I'm staring at a very blue screen at 11pm. This is on a Mac, it might be fine on other platforms.
I've have similar issues when switching back and forth to an external monitor. After switching though I just quit and restart f.lux and it looks fine again.
There's a processing library for getting information from it[1], so there's certainly the possibility of using the sensor to automatically adjust the theme. I would try to write something to do that myself, but I don't have a Mac.
How would that work? Surely the brightness of the screen (which I believe the sensor can see as it is at the top of the keyboard) is more than the sunlight. Maybe using the gyroscope/anti-drop, someone made a app-switcher that worked that way.
In iTerm2 I mapped the lighter theme to CTRL-CMD-L and the dark theme to CTRL-CMD-D. I am sure there is a quick way to change the default theme as well, though I haven't really tried too hard.
[1] http://stereopsis.com/flux/