One of the key design elements of the Windows Phone platform is the theme and accent color. Users can choose from a light or dark theme as well as over a dozen accent colors. Allowing the users preferences to leak over into your app will make the experience feel more integrated into the platform. And people find it welcoming when their preferences are respected.

While you can use the puilt in static resources in xaml, there is a lot more flexibility in the code-behind. Detecting the dark theme can be done with the following code.

The light theme is just as easy if you prefer to find it this way.

The accent color is also just as simple to access. Note that now it’s a function, I’ll be referencing it in the later samples

But that is just the beginning of what you might want to do. You may want to use a lighter or darker version of an accent color.

How about transparency then?

And for some real fun, pass in a color to blend with the accent.

And the final results with the original pink accent to the left. Download my helper class.PinkTextDemo

 

One Response to “ How to detect the Windows Phone theme and accent ”

  1. Wondering, Is there a straightforward way of doing this:
    I have some text on a help page, that I need to change the Foreground color of, depending on the dark or light theme set.

    Should I use a iValueConverter, and then use that in the XAML to set the color ?

    Reply
Leave a Reply to Steve Bailey
Your email address will not be published.
  • ( will not be published )