ANStrColor2RGB + RGB2ANStrColor

Converts R:G:B into RGB value (as long) and RGB from long into R:G:B

CodeFunctionName
What is this?

Public

Tested

Original Work
Function ANStrColor2RGB(ANStrColor)
' ANStrColor = "146:235:232" (RRR:GGG:BBB)
ANStrColor2RGB = RGB( _
CInt(CutString3(ANStrColor, 1, ":")), _
CInt(CutString3(ANStrColor, 2, ":")), _
CInt(CutString3(ANStrColor, 3, ":")) _
)
End Function
Function RGB2ANStrColor(sLong as long)
' Converts Long to RGB
' Output = RRR:GGG:BBB
' Based on the formula ... RGB = Red + (Green*256) + (Blue*256*256)
sBlue = sLong \ 65536
sGreen = (sLong - sBlue * 65536) \ 256
sRed = sLong - (sBlue * 65536) - (sGreen * 256)
RGB2ANStrColor = sRed & ":" & sGreen & ":" & sBlue
End Function

ANStrColor
or
sLong

Views 4,675

Downloads 1,391

CodeID
DB ID