[AccessD] HTML color vs VBA color
Stuart McLachlan
stuart at lexacorp.com.pg
Mon Jul 18 20:24:16 CDT 2022
Dang, you're right. MS does it again.
Some API functions use RGB and some use BGR. Apparently VBA is in the BGR camp.
( I didn't check the actual values of vbRed etc :( )
This from my PB manual:
"Some Windows API functions, such as those which reference Device
Independent Bitmaps (DIB), require that the colors be specified in the
reverse sequence (Blue-Green-Red instead of Red-Green-Blue)."
The function needs to be:
Function HTMLColour(VBAColor As Long) As String
Dim BGR As String
BGR = Right$("000000" & Hex$(VBAColor), 6)
HTMLColour = "#" & Right$(BGR, 2) & Mid$(BGR, 3, 2) & Left$(BGR, 2)
End Function
On 18 Jul 2022 at 19:44, John Colby wrote:
> I am reading that HTML color uses RRGGBB notation and vba uses BBGGRR
> notation.
>
> As most of us know, each octet goes from 00-FF, so FF0000 is pure blue
> in VBA constant speak, but *apparently* 0000FF is pure blue in HTML
> speak.
>
> Reminds me of the bad old days of Little Endian where processors named
> their bits from different ends of the memory word. Ick and eek in
> this case
>
More information about the AccessD
mailing list