Reputation: 1723
I need the new accent colors from Windows Phone 8 for my app. I've found the AccentColors.dll in the directory C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Design\AccentColors.
How can I use this lib?
Upvotes: 0
Views: 187
Reputation: 12465
If you need to use the colors in code you can add a new class that mimics the Colors class. Then you can easily use it.
public sealed class AccentColors
{
public static Color Cobalt { get { return Color.FromArgb(255, 0, 80, 239); } }
public static Color Lime { get { return Color.FromArgb(255, 164, 196, 0); } }
public static Color Green { get { return Color.FromArgb(255, 96, 169, 23); } }
public static Color Emerald { get { return Color.FromArgb(255, 0, 138, 0); } }
public static Color Teal { get { return Color.FromArgb(255, 0, 171, 169); } }
public static Color Cyan { get { return Color.FromArgb(255, 27, 161, 226); } }
public static Color Indigo { get { return Color.FromArgb(255, 106, 0, 255); } }
public static Color Violet { get { return Color.FromArgb(255, 170, 0, 255); } }
public static Color Pink { get { return Color.FromArgb(255, 244, 114, 208); } }
public static Color Magenta { get { return Color.FromArgb(255, 216, 0, 115); } }
public static Color Crimson { get { return Color.FromArgb(255, 162, 0, 37); } }
public static Color Red { get { return Color.FromArgb(255, 229, 20, 0); } }
public static Color Orange { get { return Color.FromArgb(255, 250, 104, 0); } }
public static Color Amber { get { return Color.FromArgb(255, 240, 163, 10); } }
public static Color Yellow { get { return Color.FromArgb(255, 216, 193, 0); } }
public static Color Brown { get { return Color.FromArgb(255, 130, 90, 44); } }
public static Color Olive { get { return Color.FromArgb(255, 109, 135, 100); } }
public static Color Steel { get { return Color.FromArgb(255, 100, 118, 135); } }
public static Color Mauve { get { return Color.FromArgb(255, 118, 96, 138); } }
public static Color Sienna { get { return Color.FromArgb(255, 122, 59, 63); } }
}
In your project you can then do
var coblat = AccentColors.Cobalt;
If you want to display the colors to a user, here is a simple example. First add a method that will turn the accent colors into a collection.
public static IEnumerable<Color> AsEnumerable()
{
yield return Cobalt;
yield return Lime;
yield return Green;
yield return Emerald;
// and the rest
}
Then create a ListBox to display the colors.
<ListBox x:Name="ColorPicker">
<ListBox.ItemTemplate>
<DataTemplate>
<Rectangle Fill="{Binding}" Width="100" Height="100"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
And finally set the ItemsSource to be the colors
// In code behind
ColorPicker.ItemsSource = AccentColors.AsEnumerable();
Upvotes: 3
Reputation: 16102
AccentColors.dll isn't meant for 3rd party developers to use. It's probably part of the design-time support added for Blend.
What exactly are you trying to do?
All the default accent colors are listed in the files in that folder. You can get the active accent using PhoneAccentColor/PhoneAccentBrsh. And you can override the PhoneAccentColor by changing the App.Resources in your app's c'tor.
Upvotes: 3