Windows Phone Mango Resources Part 2: Colors
Join the DZone community and get the full member experience.Join For Free
This is part 2 in the Resource series.
What Accent Colors are there?
Windows Phone supports 10 standard accent colors. The user selects the accent color per their preferences. Your application can read this color, but not influence it in any way. In fact, your application cannot (at least right now) impact the value of any phone setting.
Note: There is also an eleventh accent color that the mobile operator or hardware manufacturer can add to the phone. Your application should be aware of this extra color and not make assumptions on just the 10 system-wide colors. For example, do not have code that checks for the standard 10 accent colors and then performs a specific operation. If an eleventh color is present, it can break your code.
Determine the Accent Color
If might be important for you to know what the current accent color is. Here’s a nice snippet to help you do just that:
Next: What Color Resources are there?
What Color Resources are there?
the Windows Phone SDK conveniently gives you the raw XAML of each theme’s resource. Find them here:
64-bit Operating Systems: C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Design
32-bit Operating Systems: C:\Program Files\Microsoft SDKs\Windows Phone\v7.1\Design
Note: The most important part of these XAML files is that you can include them in your Windows Phone application for to emulate a specific theme – without requiring the phone to have that theme selected. They can also be a nice starting point to create a fully custom theme for your application.
The base colors are:
Specifically, Dark theme colors are:
Specifically, Light theme colors are:
Here’s how to use them
You reference System Resources like normal Static Resources you might add on your own.
Please note that some properties require a color. While some properties require a brush. The system brushes are solid color implementations of the system colors. Using a brush or a color should render the same result – just match the expected data type of the property.
Next: Part 3 – Sizes
Opinions expressed by DZone contributors are their own.