Library code snippets

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

Comments

  1. 01 Jan 1999 at 00:00

    This thread is for discussions of Converting HTML Colour to RGB.

Leave a comment

Sign in or Join us (it's free).

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.
AddThis

Related discussion

Related podcasts

  • Christian Beauclair

    14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...

Want to stay in touch with what's going on? Follow us on twitter!