Translating C# Color to Silverlight Color

I’ve used a lot of named C# colors in my FreeGoo project and currently I’m trying to migrate my C# code to Silverlight – which doesn’t have the same colors.

In C#, the color class is located in System.Drawing and in Silverlight it’s located in System.Windows.Media.

System.Drawing.Color

The C# color, System.Drawing.Color, contains lots and lots of nice constant colors that can be used in code. See this document for the available c# color constants.

System.Windows.Media.Color

The Silverlight color, System.Windows.Media.Color, only contains a handful of color constants!

Handling both in C# and Silverlight

So, how do we handle this when we have code that must execute – both in C# and in Silverlight? Well, if C#/Silverlight allowed static extension methods, we could possibly use that, but since they don’t, we must create a wrapper class. Actually, we create two color wrapper classes, one to use in Silverlight and one to use in C#. Both will be called ColorWrapper.

Using Reflection – and Lambda – to identify color constants

I’ll use reflection to create the color constants; since the C# Color class contains the color constants, I’ll use that to create a list of color constants.

This code reveals that there are 141 color constants;

        static void Main(string[] args)
        {
            List<PropertyInfo> propertyInfos =
                typeof(Color)
                    .GetProperties(BindingFlags.Static | BindingFlags.Public)
                    .Where(prop => prop.PropertyType == typeof(Color))
                    .ToList();

            Console.WriteLine("Color constants: {0}", propertyInfos.Count);
            propertyInfos.ForEach(prop => Console.WriteLine("Prop: " + prop.Name));

            Console.ReadKey();
        }
Loading a C# color as a Silverlight Color

If you wish to load a C# color as a Silverlight color, you must identify Red, Green, Blue and Alpha Values and use these in the color constructor. Tweaking the code above to also retrieve the color (with the ARGB values), allows us to output the code we’ll use for Silverlight. And since we need to use the same code in C#, we need a color translator that’ll work with C# as well.

Generate ColorConstants for C#

In C#, it’ll simply return the same color as is returned by the color object itself, looks silly, but makes cross target compiling possible. Note the double curly braces, they’re required since we’re using a format string;

        static void Main(string[] args)
        {
            List<PropertyInfo> propertyInfos =
                typeof(Color)
                    .GetProperties(BindingFlags.Static | BindingFlags.Public)
                    .Where(prop => prop.PropertyType == typeof(Color))
                    .ToList();

            Console.WriteLine("Color constants: {0}", propertyInfos.Count);
            propertyInfos.ForEach(
                prop => Console.WriteLine(
                    "public static Color {0} {{get{{return Color.{0};}}}}", 
                    prop.Name));

            Console.ReadKey();
        }
Generate ColorConstants for Silverlight

Generating the Silverlight ColorConstants is slightly more complicated, but not all that much. There is a method that takes ARGB to generate the color, and in the code above we’re a breath away from knowing the ARGB values. This code does the trick;

        static void Main(string[] args)
        {
            List<PropertyInfo> propertyInfos =
                typeof(Color)
                    .GetProperties(BindingFlags.Static | BindingFlags.Public)
                    .Where(prop => prop.PropertyType == typeof(Color))
                    .ToList();

            Console.WriteLine("Color constants: {0}", propertyInfos.Count);
            propertyInfos.ForEach(
                prop =>
                {
                    Color color = (Color)prop.GetValue(null, null);
                    Console.WriteLine(
                        "public static Color {0} {{get{{return Color.FromArgb({1}, {2}, {3}, {4});}}}}",
                        prop.Name,
                        color.A,
                        color.R,
                        color.G,
                        color.B);
                });

            Console.ReadKey();
        }

For completeness, the actual classes;

C# ColorConstants

Only ever use this if you have a project that you must use in both C# and Silverlight;

using System.Drawing;

public static class ColorConstants
{
    public static Color Transparent { get { return Color.Transparent; } }
    public static Color AliceBlue { get { return Color.AliceBlue; } }
    public static Color AntiqueWhite { get { return Color.AntiqueWhite; } }
    public static Color Aqua { get { return Color.Aqua; } }
    public static Color Aquamarine { get { return Color.Aquamarine; } }
    public static Color Azure { get { return Color.Azure; } }
    public static Color Beige { get { return Color.Beige; } }
    public static Color Bisque { get { return Color.Bisque; } }
    public static Color Black { get { return Color.Black; } }
    public static Color BlanchedAlmond { get { return Color.BlanchedAlmond; } }
    public static Color Blue { get { return Color.Blue; } }
    public static Color BlueViolet { get { return Color.BlueViolet; } }
    public static Color Brown { get { return Color.Brown; } }
    public static Color BurlyWood { get { return Color.BurlyWood; } }
    public static Color CadetBlue { get { return Color.CadetBlue; } }
    public static Color Chartreuse { get { return Color.Chartreuse; } }
    public static Color Chocolate { get { return Color.Chocolate; } }
    public static Color Coral { get { return Color.Coral; } }
    public static Color CornflowerBlue { get { return Color.CornflowerBlue; } }
    public static Color Cornsilk { get { return Color.Cornsilk; } }
    public static Color Crimson { get { return Color.Crimson; } }
    public static Color Cyan { get { return Color.Cyan; } }
    public static Color DarkBlue { get { return Color.DarkBlue; } }
    public static Color DarkCyan { get { return Color.DarkCyan; } }
    public static Color DarkGoldenrod { get { return Color.DarkGoldenrod; } }
    public static Color DarkGray { get { return Color.DarkGray; } }
    public static Color DarkGreen { get { return Color.DarkGreen; } }
    public static Color DarkKhaki { get { return Color.DarkKhaki; } }
    public static Color DarkMagenta { get { return Color.DarkMagenta; } }
    public static Color DarkOliveGreen { get { return Color.DarkOliveGreen; } }
    public static Color DarkOrange { get { return Color.DarkOrange; } }
    public static Color DarkOrchid { get { return Color.DarkOrchid; } }
    public static Color DarkRed { get { return Color.DarkRed; } }
    public static Color DarkSalmon { get { return Color.DarkSalmon; } }
    public static Color DarkSeaGreen { get { return Color.DarkSeaGreen; } }
    public static Color DarkSlateBlue { get { return Color.DarkSlateBlue; } }
    public static Color DarkSlateGray { get { return Color.DarkSlateGray; } }
    public static Color DarkTurquoise { get { return Color.DarkTurquoise; } }
    public static Color DarkViolet { get { return Color.DarkViolet; } }
    public static Color DeepPink { get { return Color.DeepPink; } }
    public static Color DeepSkyBlue { get { return Color.DeepSkyBlue; } }
    public static Color DimGray { get { return Color.DimGray; } }
    public static Color DodgerBlue { get { return Color.DodgerBlue; } }
    public static Color Firebrick { get { return Color.Firebrick; } }
    public static Color FloralWhite { get { return Color.FloralWhite; } }
    public static Color ForestGreen { get { return Color.ForestGreen; } }
    public static Color Fuchsia { get { return Color.Fuchsia; } }
    public static Color Gainsboro { get { return Color.Gainsboro; } }
    public static Color GhostWhite { get { return Color.GhostWhite; } }
    public static Color Gold { get { return Color.Gold; } }
    public static Color Goldenrod { get { return Color.Goldenrod; } }
    public static Color Gray { get { return Color.Gray; } }
    public static Color Green { get { return Color.Green; } }
    public static Color GreenYellow { get { return Color.GreenYellow; } }
    public static Color Honeydew { get { return Color.Honeydew; } }
    public static Color HotPink { get { return Color.HotPink; } }
    public static Color IndianRed { get { return Color.IndianRed; } }
    public static Color Indigo { get { return Color.Indigo; } }
    public static Color Ivory { get { return Color.Ivory; } }
    public static Color Khaki { get { return Color.Khaki; } }
    public static Color Lavender { get { return Color.Lavender; } }
    public static Color LavenderBlush { get { return Color.LavenderBlush; } }
    public static Color LawnGreen { get { return Color.LawnGreen; } }
    public static Color LemonChiffon { get { return Color.LemonChiffon; } }
    public static Color LightBlue { get { return Color.LightBlue; } }
    public static Color LightCoral { get { return Color.LightCoral; } }
    public static Color LightCyan { get { return Color.LightCyan; } }
    public static Color LightGoldenrodYellow { get { return Color.LightGoldenrodYellow; } }
    public static Color LightGreen { get { return Color.LightGreen; } }
    public static Color LightGray { get { return Color.LightGray; } }
    public static Color LightPink { get { return Color.LightPink; } }
    public static Color LightSalmon { get { return Color.LightSalmon; } }
    public static Color LightSeaGreen { get { return Color.LightSeaGreen; } }
    public static Color LightSkyBlue { get { return Color.LightSkyBlue; } }
    public static Color LightSlateGray { get { return Color.LightSlateGray; } }
    public static Color LightSteelBlue { get { return Color.LightSteelBlue; } }
    public static Color LightYellow { get { return Color.LightYellow; } }
    public static Color Lime { get { return Color.Lime; } }
    public static Color LimeGreen { get { return Color.LimeGreen; } }
    public static Color Linen { get { return Color.Linen; } }
    public static Color Magenta { get { return Color.Magenta; } }
    public static Color Maroon { get { return Color.Maroon; } }
    public static Color MediumAquamarine { get { return Color.MediumAquamarine; } }
    public static Color MediumBlue { get { return Color.MediumBlue; } }
    public static Color MediumOrchid { get { return Color.MediumOrchid; } }
    public static Color MediumPurple { get { return Color.MediumPurple; } }
    public static Color MediumSeaGreen { get { return Color.MediumSeaGreen; } }
    public static Color MediumSlateBlue { get { return Color.MediumSlateBlue; } }
    public static Color MediumSpringGreen { get { return Color.MediumSpringGreen; } }
    public static Color MediumTurquoise { get { return Color.MediumTurquoise; } }
    public static Color MediumVioletRed { get { return Color.MediumVioletRed; } }
    public static Color MidnightBlue { get { return Color.MidnightBlue; } }
    public static Color MintCream { get { return Color.MintCream; } }
    public static Color MistyRose { get { return Color.MistyRose; } }
    public static Color Moccasin { get { return Color.Moccasin; } }
    public static Color NavajoWhite { get { return Color.NavajoWhite; } }
    public static Color Navy { get { return Color.Navy; } }
    public static Color OldLace { get { return Color.OldLace; } }
    public static Color Olive { get { return Color.Olive; } }
    public static Color OliveDrab { get { return Color.OliveDrab; } }
    public static Color Orange { get { return Color.Orange; } }
    public static Color OrangeRed { get { return Color.OrangeRed; } }
    public static Color Orchid { get { return Color.Orchid; } }
    public static Color PaleGoldenrod { get { return Color.PaleGoldenrod; } }
    public static Color PaleGreen { get { return Color.PaleGreen; } }
    public static Color PaleTurquoise { get { return Color.PaleTurquoise; } }
    public static Color PaleVioletRed { get { return Color.PaleVioletRed; } }
    public static Color PapayaWhip { get { return Color.PapayaWhip; } }
    public static Color PeachPuff { get { return Color.PeachPuff; } }
    public static Color Peru { get { return Color.Peru; } }
    public static Color Pink { get { return Color.Pink; } }
    public static Color Plum { get { return Color.Plum; } }
    public static Color PowderBlue { get { return Color.PowderBlue; } }
    public static Color Purple { get { return Color.Purple; } }
    public static Color Red { get { return Color.Red; } }
    public static Color RosyBrown { get { return Color.RosyBrown; } }
    public static Color RoyalBlue { get { return Color.RoyalBlue; } }
    public static Color SaddleBrown { get { return Color.SaddleBrown; } }
    public static Color Salmon { get { return Color.Salmon; } }
    public static Color SandyBrown { get { return Color.SandyBrown; } }
    public static Color SeaGreen { get { return Color.SeaGreen; } }
    public static Color SeaShell { get { return Color.SeaShell; } }
    public static Color Sienna { get { return Color.Sienna; } }
    public static Color Silver { get { return Color.Silver; } }
    public static Color SkyBlue { get { return Color.SkyBlue; } }
    public static Color SlateBlue { get { return Color.SlateBlue; } }
    public static Color SlateGray { get { return Color.SlateGray; } }
    public static Color Snow { get { return Color.Snow; } }
    public static Color SpringGreen { get { return Color.SpringGreen; } }
    public static Color SteelBlue { get { return Color.SteelBlue; } }
    public static Color Tan { get { return Color.Tan; } }
    public static Color Teal { get { return Color.Teal; } }
    public static Color Thistle { get { return Color.Thistle; } }
    public static Color Tomato { get { return Color.Tomato; } }
    public static Color Turquoise { get { return Color.Turquoise; } }
    public static Color Violet { get { return Color.Violet; } }
    public static Color Wheat { get { return Color.Wheat; } }
    public static Color White { get { return Color.White; } }
    public static Color WhiteSmoke { get { return Color.WhiteSmoke; } }
    public static Color Yellow { get { return Color.Yellow; } }
    public static Color YellowGreen { get { return Color.YellowGreen; } }
}
Silverlight ColorConstants
using System.Windows.Media;

public class ColorConstants
{
    public static Color Transparent { get { return Color.FromArgb(0, 255, 255, 255); } }
    public static Color AliceBlue { get { return Color.FromArgb(255, 240, 248, 255); } }
    public static Color AntiqueWhite { get { return Color.FromArgb(255, 250, 235, 215); } }
    public static Color Aqua { get { return Color.FromArgb(255, 0, 255, 255); } }
    public static Color Aquamarine { get { return Color.FromArgb(255, 127, 255, 212); } }
    public static Color Azure { get { return Color.FromArgb(255, 240, 255, 255); } }
    public static Color Beige { get { return Color.FromArgb(255, 245, 245, 220); } }
    public static Color Bisque { get { return Color.FromArgb(255, 255, 228, 196); } }
    public static Color Black { get { return Color.FromArgb(255, 0, 0, 0); } }
    public static Color BlanchedAlmond { get { return Color.FromArgb(255, 255, 235, 205); } }
    public static Color Blue { get { return Color.FromArgb(255, 0, 0, 255); } }
    public static Color BlueViolet { get { return Color.FromArgb(255, 138, 43, 226); } }
    public static Color Brown { get { return Color.FromArgb(255, 165, 42, 42); } }
    public static Color BurlyWood { get { return Color.FromArgb(255, 222, 184, 135); } }
    public static Color CadetBlue { get { return Color.FromArgb(255, 95, 158, 160); } }
    public static Color Chartreuse { get { return Color.FromArgb(255, 127, 255, 0); } }
    public static Color Chocolate { get { return Color.FromArgb(255, 210, 105, 30); } }
    public static Color Coral { get { return Color.FromArgb(255, 255, 127, 80); } }
    public static Color CornflowerBlue { get { return Color.FromArgb(255, 100, 149, 237); } }
    public static Color Cornsilk { get { return Color.FromArgb(255, 255, 248, 220); } }
    public static Color Crimson { get { return Color.FromArgb(255, 220, 20, 60); } }
    public static Color Cyan { get { return Color.FromArgb(255, 0, 255, 255); } }
    public static Color DarkBlue { get { return Color.FromArgb(255, 0, 0, 139); } }
    public static Color DarkCyan { get { return Color.FromArgb(255, 0, 139, 139); } }
    public static Color DarkGoldenrod { get { return Color.FromArgb(255, 184, 134, 11); } }
    public static Color DarkGray { get { return Color.FromArgb(255, 169, 169, 169); } }
    public static Color DarkGreen { get { return Color.FromArgb(255, 0, 100, 0); } }
    public static Color DarkKhaki { get { return Color.FromArgb(255, 189, 183, 107); } }
    public static Color DarkMagenta { get { return Color.FromArgb(255, 139, 0, 139); } }
    public static Color DarkOliveGreen { get { return Color.FromArgb(255, 85, 107, 47); } }
    public static Color DarkOrange { get { return Color.FromArgb(255, 255, 140, 0); } }
    public static Color DarkOrchid { get { return Color.FromArgb(255, 153, 50, 204); } }
    public static Color DarkRed { get { return Color.FromArgb(255, 139, 0, 0); } }
    public static Color DarkSalmon { get { return Color.FromArgb(255, 233, 150, 122); } }
    public static Color DarkSeaGreen { get { return Color.FromArgb(255, 143, 188, 139); } }
    public static Color DarkSlateBlue { get { return Color.FromArgb(255, 72, 61, 139); } }
    public static Color DarkSlateGray { get { return Color.FromArgb(255, 47, 79, 79); } }
    public static Color DarkTurquoise { get { return Color.FromArgb(255, 0, 206, 209); } }
    public static Color DarkViolet { get { return Color.FromArgb(255, 148, 0, 211); } }
    public static Color DeepPink { get { return Color.FromArgb(255, 255, 20, 147); } }
    public static Color DeepSkyBlue { get { return Color.FromArgb(255, 0, 191, 255); } }
    public static Color DimGray { get { return Color.FromArgb(255, 105, 105, 105); } }
    public static Color DodgerBlue { get { return Color.FromArgb(255, 30, 144, 255); } }
    public static Color Firebrick { get { return Color.FromArgb(255, 178, 34, 34); } }
    public static Color FloralWhite { get { return Color.FromArgb(255, 255, 250, 240); } }
    public static Color ForestGreen { get { return Color.FromArgb(255, 34, 139, 34); } }
    public static Color Fuchsia { get { return Color.FromArgb(255, 255, 0, 255); } }
    public static Color Gainsboro { get { return Color.FromArgb(255, 220, 220, 220); } }
    public static Color GhostWhite { get { return Color.FromArgb(255, 248, 248, 255); } }
    public static Color Gold { get { return Color.FromArgb(255, 255, 215, 0); } }
    public static Color Goldenrod { get { return Color.FromArgb(255, 218, 165, 32); } }
    public static Color Gray { get { return Color.FromArgb(255, 128, 128, 128); } }
    public static Color Green { get { return Color.FromArgb(255, 0, 128, 0); } }
    public static Color GreenYellow { get { return Color.FromArgb(255, 173, 255, 47); } }
    public static Color Honeydew { get { return Color.FromArgb(255, 240, 255, 240); } }
    public static Color HotPink { get { return Color.FromArgb(255, 255, 105, 180); } }
    public static Color IndianRed { get { return Color.FromArgb(255, 205, 92, 92); } }
    public static Color Indigo { get { return Color.FromArgb(255, 75, 0, 130); } }
    public static Color Ivory { get { return Color.FromArgb(255, 255, 255, 240); } }
    public static Color Khaki { get { return Color.FromArgb(255, 240, 230, 140); } }
    public static Color Lavender { get { return Color.FromArgb(255, 230, 230, 250); } }
    public static Color LavenderBlush { get { return Color.FromArgb(255, 255, 240, 245); } }
    public static Color LawnGreen { get { return Color.FromArgb(255, 124, 252, 0); } }
    public static Color LemonChiffon { get { return Color.FromArgb(255, 255, 250, 205); } }
    public static Color LightBlue { get { return Color.FromArgb(255, 173, 216, 230); } }
    public static Color LightCoral { get { return Color.FromArgb(255, 240, 128, 128); } }
    public static Color LightCyan { get { return Color.FromArgb(255, 224, 255, 255); } }
    public static Color LightGoldenrodYellow { get { return Color.FromArgb(255, 250, 250, 210); } }
    public static Color LightGreen { get { return Color.FromArgb(255, 144, 238, 144); } }
    public static Color LightGray { get { return Color.FromArgb(255, 211, 211, 211); } }
    public static Color LightPink { get { return Color.FromArgb(255, 255, 182, 193); } }
    public static Color LightSalmon { get { return Color.FromArgb(255, 255, 160, 122); } }
    public static Color LightSeaGreen { get { return Color.FromArgb(255, 32, 178, 170); } }
    public static Color LightSkyBlue { get { return Color.FromArgb(255, 135, 206, 250); } }
    public static Color LightSlateGray { get { return Color.FromArgb(255, 119, 136, 153); } }
    public static Color LightSteelBlue { get { return Color.FromArgb(255, 176, 196, 222); } }
    public static Color LightYellow { get { return Color.FromArgb(255, 255, 255, 224); } }
    public static Color Lime { get { return Color.FromArgb(255, 0, 255, 0); } }
    public static Color LimeGreen { get { return Color.FromArgb(255, 50, 205, 50); } }
    public static Color Linen { get { return Color.FromArgb(255, 250, 240, 230); } }
    public static Color Magenta { get { return Color.FromArgb(255, 255, 0, 255); } }
    public static Color Maroon { get { return Color.FromArgb(255, 128, 0, 0); } }
    public static Color MediumAquamarine { get { return Color.FromArgb(255, 102, 205, 170); } }
    public static Color MediumBlue { get { return Color.FromArgb(255, 0, 0, 205); } }
    public static Color MediumOrchid { get { return Color.FromArgb(255, 186, 85, 211); } }
    public static Color MediumPurple { get { return Color.FromArgb(255, 147, 112, 219); } }
    public static Color MediumSeaGreen { get { return Color.FromArgb(255, 60, 179, 113); } }
    public static Color MediumSlateBlue { get { return Color.FromArgb(255, 123, 104, 238); } }
    public static Color MediumSpringGreen { get { return Color.FromArgb(255, 0, 250, 154); } }
    public static Color MediumTurquoise { get { return Color.FromArgb(255, 72, 209, 204); } }
    public static Color MediumVioletRed { get { return Color.FromArgb(255, 199, 21, 133); } }
    public static Color MidnightBlue { get { return Color.FromArgb(255, 25, 25, 112); } }
    public static Color MintCream { get { return Color.FromArgb(255, 245, 255, 250); } }
    public static Color MistyRose { get { return Color.FromArgb(255, 255, 228, 225); } }
    public static Color Moccasin { get { return Color.FromArgb(255, 255, 228, 181); } }
    public static Color NavajoWhite { get { return Color.FromArgb(255, 255, 222, 173); } }
    public static Color Navy { get { return Color.FromArgb(255, 0, 0, 128); } }
    public static Color OldLace { get { return Color.FromArgb(255, 253, 245, 230); } }
    public static Color Olive { get { return Color.FromArgb(255, 128, 128, 0); } }
    public static Color OliveDrab { get { return Color.FromArgb(255, 107, 142, 35); } }
    public static Color Orange { get { return Color.FromArgb(255, 255, 165, 0); } }
    public static Color OrangeRed { get { return Color.FromArgb(255, 255, 69, 0); } }
    public static Color Orchid { get { return Color.FromArgb(255, 218, 112, 214); } }
    public static Color PaleGoldenrod { get { return Color.FromArgb(255, 238, 232, 170); } }
    public static Color PaleGreen { get { return Color.FromArgb(255, 152, 251, 152); } }
    public static Color PaleTurquoise { get { return Color.FromArgb(255, 175, 238, 238); } }
    public static Color PaleVioletRed { get { return Color.FromArgb(255, 219, 112, 147); } }
    public static Color PapayaWhip { get { return Color.FromArgb(255, 255, 239, 213); } }
    public static Color PeachPuff { get { return Color.FromArgb(255, 255, 218, 185); } }
    public static Color Peru { get { return Color.FromArgb(255, 205, 133, 63); } }
    public static Color Pink { get { return Color.FromArgb(255, 255, 192, 203); } }
    public static Color Plum { get { return Color.FromArgb(255, 221, 160, 221); } }
    public static Color PowderBlue { get { return Color.FromArgb(255, 176, 224, 230); } }
    public static Color Purple { get { return Color.FromArgb(255, 128, 0, 128); } }
    public static Color Red { get { return Color.FromArgb(255, 255, 0, 0); } }
    public static Color RosyBrown { get { return Color.FromArgb(255, 188, 143, 143); } }
    public static Color RoyalBlue { get { return Color.FromArgb(255, 65, 105, 225); } }
    public static Color SaddleBrown { get { return Color.FromArgb(255, 139, 69, 19); } }
    public static Color Salmon { get { return Color.FromArgb(255, 250, 128, 114); } }
    public static Color SandyBrown { get { return Color.FromArgb(255, 244, 164, 96); } }
    public static Color SeaGreen { get { return Color.FromArgb(255, 46, 139, 87); } }
    public static Color SeaShell { get { return Color.FromArgb(255, 255, 245, 238); } }
    public static Color Sienna { get { return Color.FromArgb(255, 160, 82, 45); } }
    public static Color Silver { get { return Color.FromArgb(255, 192, 192, 192); } }
    public static Color SkyBlue { get { return Color.FromArgb(255, 135, 206, 235); } }
    public static Color SlateBlue { get { return Color.FromArgb(255, 106, 90, 205); } }
    public static Color SlateGray { get { return Color.FromArgb(255, 112, 128, 144); } }
    public static Color Snow { get { return Color.FromArgb(255, 255, 250, 250); } }
    public static Color SpringGreen { get { return Color.FromArgb(255, 0, 255, 127); } }
    public static Color SteelBlue { get { return Color.FromArgb(255, 70, 130, 180); } }
    public static Color Tan { get { return Color.FromArgb(255, 210, 180, 140); } }
    public static Color Teal { get { return Color.FromArgb(255, 0, 128, 128); } }
    public static Color Thistle { get { return Color.FromArgb(255, 216, 191, 216); } }
    public static Color Tomato { get { return Color.FromArgb(255, 255, 99, 71); } }
    public static Color Turquoise { get { return Color.FromArgb(255, 64, 224, 208); } }
    public static Color Violet { get { return Color.FromArgb(255, 238, 130, 238); } }
    public static Color Wheat { get { return Color.FromArgb(255, 245, 222, 179); } }
    public static Color White { get { return Color.FromArgb(255, 255, 255, 255); } }
    public static Color WhiteSmoke { get { return Color.FromArgb(255, 245, 245, 245); } }
    public static Color Yellow { get { return Color.FromArgb(255, 255, 255, 0); } }
    public static Color YellowGreen { get { return Color.FromArgb(255, 154, 205, 50); } }
}

About mfagerlund
Writes code in my sleep - and sometimes it even compiles!

One Response to Translating C# Color to Silverlight Color

  1. Pingback: Translating C# Brushes to Silverlight Brushes « Mattias Fagerlund's Coding Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: