if all you're looking for are complemetary colors:
color_comp = 1.0 - color

That being said, you might want to make the effect a bit less intense. I'm pretty sure using complete opposite colors will give a way too strong effect.

Also, in real life, light vs shadow colors don't have to be complementary. Though, in your case (sunlight) you're right, since the sky adds some blue ambient light while the sun is mostly white-yellow-orange-ish which is complementary to the blue.
You also get a similar effect with neutral ambient light (like grey) and a colored light source (since visual perception is somewhat relative) but I don't want to bring up too much of the theory stuff here.


POTATO-MAN saves the day! - Random