Hello everyone,
So I am trying to convert an RGBA color to a Hex color.
The above code seems to work but if you look closely it only works when I pass the params of
xui.Color_ARGB as r, g, b, a but the original order of the param is a, r, g, b
What could be wrong or is this the expected behaviour?
So I am trying to convert an RGBA color to a Hex color.
B4X:
Private Sub ColorToHex(clr As Int) As String
Dim bc As ByteConverter
Return bc.HexFromBytes(bc.IntsToBytes(Array As Int(clr)))
End Sub
Private Sub RgbaToHex(RgbaColorStr As String) As String
Dim parts() As String = Regex.Split(",", RgbaColorStr.SubString2(5, RgbaColorStr.Length - 1))
Dim a As Float
Dim r, g, b As Int
r = parts(0)
g = parts(1)
b = parts(2)
a = Round(255 * parts(3))
Return "#" & ColorToHex(xui.Color_ARGB(r, g, b, a))
End Sub
The above code seems to work but if you look closely it only works when I pass the params of
xui.Color_ARGB as r, g, b, a but the original order of the param is a, r, g, b
What could be wrong or is this the expected behaviour?