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" />

  One Response to “Darker Shade of the PhoneAccentBrush”

  1. Very helpful! Thanks.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
© 2012 Unknown Programmer Suffusion theme by Sayontan Sinha