### Color Paint as Hex String

Several options to convert the Color Paint Value to Hex String
Option 1
Dim ColorValue As Paint
Convert the Color Value to 32 bit integer:
Dim ColorInt As Int = fx.Colors.To32Bit(ColorValue)
Convert to Hex String AARRGGBB
Dim HexARGB As String = Bit.ToHexString(ColorInt)
Convert to Hex String RRGGBB
Dim HexRGB As String = HexARGB.SubString2(2,8)
Example Result
Hex ARGB for Color RED:
Log($"${HexARGB}, ${HexRGB}"$)
ffff0000, ff0000
Hint Copy HexRGB to Clipboard
fx.Clipboard.SetString($"#${HexRGB}"$)
Option 2 using JavaFX API (requires JavaObject library)
' Get the color given as paint as a string
' Example result is 0xb31a1aff
`Sub GetColorHexString(ColorValue As Paint) As String
Dim result As String = ""
Dim joCP As JavaObject = ColorValue
result = joCP.RunMethod("toString", Null)
Return result
End Sub`

Changed: , Category: Colors, File: T6C174M1256.htm, ID: 1256