Getting device background color day or night?

How do I know if the device is in day or night mode? I want to set correct front/background color to my datafield.