using System.Windows.Media;
public static class Utilities
{
///
/// Helper method to get a color based on it's string value
///
/// The name of the string, for example red
/// A brush with the color, bla
public static Brush StringToBrush(string colorString)
{
Brush returnValue = Brushes.Black;
if (!string.IsNullOrEmpty(colorString))
{
string tempString = colorString.ToLower().Trim();
if (tempString.EndsWith("_anime"))
tempString = tempString.Replace("_anime", "");
switch (tempString)
{
case "grey":
returnValue = Brushes.Gray;
break;
case "red":
returnValue = Brushes.Red;
break;
case "blue":
returnValue = Brushes.Green;
break;
}
}
return returnValue;
}
}