/// <summary>
        /// Gets a known color from an ARGB value. Throws an ArgumentException if the value is not a known color.
        /// </summary>
        public static XKnownColor GetKnownColor(uint argb)
        {
            XKnownColor knownColor = XKnownColorTable.GetKnownColor(argb);

            if ((int)knownColor == -1)
            {
                throw new ArgumentException("The argument is not a known color", "argb");
            }
            return(knownColor);
        }
        /// <summary>
        /// Converts a color to a localized color name or an ARGB value.
        /// </summary>
        public string ToColorName(XColor color)
        {
            string name;

            if (color.IsKnownColor)
            {
                name = ToColorName(XKnownColorTable.GetKnownColor(color.Argb));
            }
            else
            {
                name = String.Format("{0}, {1}, {2}, {3}", (int)(255 * color.A), color.R, color.G, color.B);
            }
            return(name);
        }
Esempio n. 3
0
        //#endif

        //#if UWP
        //        XColor(UwpColor color)
        //            : this(color.A, color.R, color.G, color.B)
        //        { }
        //#endif

        internal XColor(XKnownColor knownColor)
            : this(XKnownColorTable.KnownColorToArgb(knownColor))
        {
        }