Sub decodeColor(C As String) As Int
Dim Match As Matcher = Regex.Matcher("[\daAbBcCdDeEfF]{8}", C) ' eight exadecimal digits
If Not(Match.Find) Then Return -16777216 ' opaque black
If (C.SubString2(0,1)).compareto("7") > 0 Then
Return - Power(2,31) + Bit.ParseInt("01234567".CharAt(Bit.ParseInt(C.SubString2(0,1),16)-8) & C.SubString(1),16)
End If
Return Bit.ParseInt(C,16)
End Sub