Is Valid Color
Determines whether a given string represents a valid HTML color.
This function uses ColorTranslator.FromHtml to validate the color format. Invalid or unrecognized color strings will cause an exception, which is caught and results in False.
VB
Public Function IsValidColor(colorString As String) As Boolean
Try
Dim color As Color = ColorTranslator.FromHtml(colorString)
Return True
Catch ex As Exception
Return False
End Try
End Function