The Windows Phone 7 has two different background color modes; dark or light. In addition, there are ten accent colors to choose from.
There’s currently no simple way of detecting which theme and accent color that the user has selected his or her device. However, since the colors of the current theme is injected into to applications resources, one can at least read out the various colors from there.
The background color can be determined using this piece of code:
Color backgroundColor = (Color)Application.Current.Resources["PhoneBackgroundColor"];
And in a similar fashion the foreground and accent colors can be determined like this:
Color foregroundColor = (Color)Application.Current.Resources["PhoneForegroundColor"]; Color accentColor = (Color)Application.Current.Resources["PhoneAccentColor"];
All the various resource names are described here; Theme Resources for Windows Phone.
|Theme||Background Color Value||Foreground Color Value|
One thought to “Windows Phone 7 Theme Colors”