[AccessD] HTML color vs VBA color
John Colby
jwcolby at gmail.com
Mon Jul 18 20:41:17 CDT 2022
And that fixed it!!! You da man!
I changed the name of your first function to VBAColour(), leaving the new
one as HTMLColour.
On Mon, Jul 18, 2022 at 9:24 PM Stuart McLachlan <stuart at lexacorp.com.pg>
wrote:
> 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
> >
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
--
John W. Colby
Colby Consulting
More information about the AccessD
mailing list