### Color Paint as RGB String

Various option to get a Color Paint as RGB string.
Option 1
'Get the color given as paint as a string in R-G-B
'Example result is 26-51-153
`Sub GetColorRGB(ColorValue As Paint) As String
Dim result As String = ""
Dim joCP As JavaObject = ColorValue
Dim R As Double = joCP.RunMethod("getRed", Null)
Dim G As Double = joCP.RunMethod("getGreen", Null)
Dim B As Double = joCP.RunMethod("getBlue", Null)
result = Round(R * 255) & "-" & Round(G * 255) & "-" & Round(B * 255)
Return result
End Sub`
Option 2 - using CSSUtils Library
Dim color As Paint = fx.Colors.blue
Dim c As String = CSSUtils.ColorToHex(color)
' Clean up rgba(0,0,255,1.00) to get 0,0,255,1.00
c = c.Replace("rgba(", "").Replace(")", "")
' Get the 4 values RGBA
Dim cs() As String = Regex.Split(",", c)
Log($"RGB=${cs(0)}-${cs(1)}-${cs(2)}"$)
Log($"RGBA=${cs(0)}-${cs(1)}-${cs(2)}-${cs(3)}"$)
Example Result:
RGB=0-0-255
RGBA=0-0-255-1.00

Changed: , Category: Colors, File: T6C174M1257.htm, ID: 1257