using System;
using System.Windows.Media;

namespace Machinations
{
    public static class ColorsUtils
    {
        public static Color DefaultColor = Colors.DarkSeaGreen;              // za 1000000
        public static Color TransparentColor = Colors.Transparent;          // za 01000000
        public static Color InitColor = Colors.Black;                       // za 000000

        public static Brush ConnectionTextBrush = new SolidColorBrush(Colors.AntiqueWhite);
        //public static Brush ConnectionSelectedTextBrush = new SolidColorBrush(Colors.Yellow);

        public static string ToNiceString(this Color color)
        {
            if (color.Equals(Colors.Black)) return "Black";
            if (color.Equals(Colors.Red)) return "Red";
            if (color.Equals(Colors.Blue)) return "Blue";
            if (color.Equals(Colors.Green)) return "Green";
            if (color.Equals(Colors.Pink)) return "Pink";
            if (color.Equals(Colors.Yellow)) return "Yellow";
            if (color.Equals(Colors.Gray)) return "Gray";
            if (color.Equals(Colors.White)) return "White";
            return color.ToString();
        }


        public static Color GetColorFromString(string colorString)
        {
            try
            {
                return (Color) ColorConverter.ConvertFromString(colorString);
            }
            catch (FormatException)
            {
                return Colors.Black;
            }
        }
    }

    
}
