While working with a darker shade of the phoneaccentbrush, I needed to maintain the uniformity of the shade across

different PhoneAccentBrushes available. To do this, I used the PhoneAccentBrush SolidColorBrush and added the generated

brush to the application resources. Here is how I did it.

In ShadeHelper.cs,

public static SolidColorBrush getDarkerShade(SolidColorBrush brush)
        {
            SolidColorBrush darkerShade = new SolidColorBrush();
            byte alpha = 255;
            byte red = (byte)(brush.Color.R - (brush.Color.R*0.4));
            byte blue = (byte)(brush.Color.B - (brush.Color.B * 0.4));
            byte green = (byte)(brush.Color.G - (brush.Color.G * 0.4));
            darkerShade.Color = Color.FromArgb(alpha, red, green, blue);
            return darkerShade;
        }

In App.xaml.cs,

Resources.Add("PhoneDarkAccentBrush", ShadeHelper.getDarkerShade((Resources["PhoneAccentBrush"] as SolidColorBrush)));

Usage:

<TextBlock x:Name="darkAccent" Foreground={StaticResource PhoneDarkAccentBrush} Text="Darker Accent" />

© 2012 Unknown Programmer Suffusion theme by Sayontan Sinha