Is Valid Color Name
Checks whether a given string corresponds to a known system-defined color name.
This function uses reflection to determine whether the specified color name exists as a static public property in the Color class, ignoring case.
VB
Public Function IsValidColorName(colorName As String) As Boolean
Dim colorType As Type = GetType(Color)
Dim colorProperty = colorType.GetProperty(colorName,
Reflection.BindingFlags.IgnoreCase Or
Reflection.BindingFlags.Static Or
Reflection.BindingFlags.Public)
Return colorProperty IsNot Nothing
End Function