Converting RGB-color to HEX color 
Author Message
 Converting RGB-color to HEX color

How do I convert a RGB color, returned by a CommonDialog Box to a HEX-
color, usable in a HTML-document? Or else, into separate red, green
and blue values. Converting to hex-values shouldn't be a problem :-)

Thanks,

MiKe.



Mon, 24 Jul 2000 03:00:00 GMT  
 Converting RGB-color to HEX color

Dear Mike,

R = Color Mod &H100
G = (Color \ &H100) Mod &H100
B = (Color \ &H10000) Mod &H100

where "Color" is a long integer returned by your CommandDialog or
Form.BackColor, etc.
No need to mention that the hex equivalent is Hex$(R), and so on.

Hope this helps,
Luca G. Fontanarosa
Sr. Software Engineer



Mon, 24 Jul 2000 03:00:00 GMT  
 Converting RGB-color to HEX color

http://www.geocities.com/CapeCanaveral/6740/allfiles.htm

256VBCOL.ZIP    256 colour picture box bitmap
GETRGB.ZIP      Extract red, green and blue hex values

http:www.winsite.com/win95/programr/vbasic/
rhgen.zip       Tool for using R(ed)G(reen)B(lue) & HEX color values

--
Henri
remove "MyName"



: How do I convert a RGB color, returned by a CommonDialog Box to a HEX-
: color, usable in a HTML-document? Or else, into separate red, green
: and blue values. Converting to hex-values shouldn't be a problem :-)

:
: Thanks,
:
: MiKe.
:



Tue, 25 Jul 2000 03:00:00 GMT  
 Converting RGB-color to HEX color



Quote:
> R = Color Mod &H100
> G = (Color \ &H100) Mod &H100
> B = (Color \ &H10000) Mod &H100

Not to be a total nit-picker or anything, but I have found the code below
to be about 5 to 10 percent faster than the above code.

    r = Color And &HFF&
    g = (Color And &HFF00&) \ &H100&
    b = (Color And &HFF0000) \ &H10000

--
Jim Houghtaling
-> VS97 sp3, WinNT 4.0 sp3, Win95 os/r2
------------
One-seventh of your life will be spent on Mondays.



Tue, 25 Jul 2000 03:00:00 GMT  
 Converting RGB-color to HEX color

Dear Jim,

sure, why not? Anything to make our programs faster.
Thank you for your suggestion.

Regards,
Luca G. Fontanarosa
Sr. Software Engineer



Tue, 25 Jul 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Converting RGB-color to HEX color

2. VB Colors vs. Web Hex RGB colors

3. Help me convert system color NAMES to hex or RGB VALUES

4. Convert Color from HEX to RGB

5. Help: Converting Hex Colors to RGB

6. Converting RGB-color into HEX?

7. Converting RGB color to HEX???

8. Help me convert system color NAMES to hex or RGB VALUES

9. Hex color to RGB?

10. convert HSB color to RGB, please help

11. Convert RGB values to System.Color

12. Convert colors to RGB values

 

 
Powered by phpBB® Forum Software