Changing fog and camera background color with script

Hi everyone. I have this script that I found here day/night cycle. I was wondering, how do I make the color of the fog and camera background color change to suit the brightness of the light? Thanks for any input.

Use RenderSettings for fog and Camera.backgroundColor for the color.