您可以获得此处所示的强调色。
// Determine the accent color.
Color currentAccentColorHex = (Color)Application.Current.Resources["PhoneAccentColor"];
如果您想要的话,这不是获取颜色名称的最漂亮方法,但您可以使用与 WP7 和 WP8 兼容的方法。
string currentAccentColor = "";
switch (currentAccentColorHex.ToString())
{
case "#FF1BA1E2": currentAccentColor = "blue"; break;
case "#FFA05000": currentAccentColor = "brown"; break;
case "#FF339933": currentAccentColor = "green"; break;
case "#FFE671B8": currentAccentColor = "pink"; break;
case "#FFA200FF": currentAccentColor = "purple"; break;
case "#FFE51400": currentAccentColor = "red"; break;
case "#FF00ABA9": currentAccentColor = "teal (viridian)"; break;
// Lime changed to #FFA2C139 in Windows Phone OS 7.1.
case "#FF8CBF26":
case "#FFA2C139": currentAccentColor = "lime"; break;
// Magenta changed to # FFD80073 in Windows Phone OS 7.1.
case "#FFFF0097":
case "#FFD80073": currentAccentColor = "magenta"; break;
// #FFF9609 (previously orange) is named mango in Windows Phone OS 7.1.
case "#FFF09609": currentAccentColor = "mango (orange)"; break;
// Mobile operator or hardware manufacturer color
default: currentAccentColor = "custom eleventh color"; break;
}
// Write the current accent color.
textBlock2.Text = "accent color = " + currentAccentColor;