Converting HTML Colour to RGB

Lets say we have a webbrowser and we want to convert the background colour to RGB and VB, here's how to do it! (webbrowser1.document.bgcolor will return "#aaffff"  or similar)


a = Webbrowser1.document.bgColor
R = Val("&H" + Mid$(a$, 2, 2))    ' Value 170
G = Val("&H" + Mid$(a$, 4, 2))   ' Value 255
B = Val("&H" + Mid$(a$, 6, 2))    ' Value 255

result = rgb(R,G,B)   ' reult is a vb color value (LONG) = 16777130

You might also like...

Comments

Kym Manson Till the Roof comes off Till the Lights go out Till my Legs give out Can't shut my mouth I will not fall, my Wisdoms all.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An idiot with a computer is a faster, better idiot” - Rich Julius