/// <summary> /// Returns C# code that generates this instance. /// </summary> /// <param name="color">The color.</param> /// <returns>The code.</returns> public static string ToCode(this OxyColor color) { var name = color.GetColorName(); if (name != null) { return(string.Format("OxyColors.{0}", name)); } return(string.Format("OxyColor.FromArgb({0}, {1}, {2}, {3})", color.A, color.R, color.G, color.B)); }