#47960 - QuantumDoja - Fri Jul 15, 2005 11:45 am
Hi, I have "Fuchsia" a purpleish color that is:
#FF00FF in web colors
255 - red
0 - green
255 - blue
16711935 as a microsoft access variable
I want to convert to a gba color, but end up with: 0x2108, and in the palette it is a dark grey, here is my code:
its vb.net
_________________
Chris Davis
#FF00FF in web colors
255 - red
0 - green
255 - blue
16711935 as a microsoft access variable
I want to convert to a gba color, but end up with: 0x2108, and in the palette it is a dark grey, here is my code:
its vb.net
Code: |
Public Function GetGBAColor(ByVal strWebSafe) As Integer Dim r, g, b Dim i As Integer r = Mid(strWebSafe, 1, 2) g = Mid(strWebSafe, 3, 2) b = Mid(strWebSafe, 5, 2) Dim rc As Integer Dim gc As Integer Dim bc As Integer For i = 0 To 255 If Hex$(i) = r Then rc = i End If Next For i = 0 To 255 If Hex$(i) = g Then gc = i End If Next For i = 0 To 255 If Hex$(i) = b Then bc = i End If Next rc = rc / 11 + 8 gc = gc / 11 + 8 bc = bc / 11 + 8 GetGBAColor = rc + (32 * gc) + (1024 * bc) End Function |
_________________
Chris Davis