How to determine theme colors from a Direct3D app for Windows Phone 8
February 03, 2014
Applies to: Windows Phone 8 only
This topic shows you how to determine the phone’s current theme colors from a Windows Phone Direct3D app. Users can customize their phone by selecting a primary accent color, but also by choosing a light or dark theme, or by choosing a high-contrast theme that a user might find easier to read. The following table lists the UI element types that you can query in a Windows Phone Direct3D app. These theme colors are defined in the UIElementType enumeration. There are other theme colors in this enumeration that are used by other platforms, but the elements in the table are the only ones supported on the phone. Attempting to query a value not in the table will cause an exception to be thrown.
UI element type
The phone's accent color.
Text that contrasts with TextHigh.
High-contrast non-text content.
Medium-high contrast non-text content.
Medium-contrast non-text content.
Medium-low contrast non-text content.
Low-contrast non-text content.
The background of a normal page.
The background of a pop-up dialog.
The partially opaque color applied to the area of the screen outside of a pop-up window to dim the background and highlight the dialog.
This code sample shows you how to get the current theme’s accent color.
It is possible for the user to switch their theme color while your app is running. If you want to handle this case, you can add a call to query the theme colors to the handler for the Resuming event, which is provided by the Direct3D app project template. This handler will be invoked if the user switches to the Settings app, and then returns to your app.