How to determine theme accent color on Windows Phone

Jul 8, 2012 by

That’s how to determine theme accent color on Windows Phone 7


// Determine the accent color.
Color currentAccentColorHex =
    (Color)Application.Current.Resources["PhoneAccentColor"];

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;
}
read more

How to determine theme background color on Windows Phone

Jul 8, 2012 by


// Determine the visibility of the dark background.
Visibility darkBackgroundVisibility =
    (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"];

// Write the theme background value.
if (darkBackgroundVisibility == Visibility.Visible)
{
    textBlock1.Text = "background = dark";
}
else
{
    textBlock1.Text = "background = light";
}
read more