Closed Thread Icon

Preserved Topic: mr max Pages that link to <a href="https://ozoneasylum.com/backlink?for=15895" title="Pages that link to Preserved Topic: mr max" rel="nofollow" >Preserved Topic: mr max\

 
Author Thread
JakeB
Paranoid (IV) Inmate

From: us
Insane since: Oct 2000

posted posted 03-23-2001 03:44

how did you get the hexcolor in your program. i think you didn't make it in visual basic, but i have that and i want something similar. I can get the same window up by commondialog.showcolor and then i can get a color from it. I think the color is in hex, but not the kind you use on a webpage. I can get a hex value by hex$(commondialog.color) but it isn't always 6 charactors. Know what i should do?

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 03-23-2001 09:05

No, MAX's HTML Beauty++ ME is completely JAVA free...

Anyway, JakeB, you're right, I'm not using Visual Basic... But, here's a VB function which you can use to get HTML hex color value:

Public Function Convert2Hex(color) as String
&nbsp;&nbsp;&nbsp;&nbsp;Dim RedValue, GreenValue, BlueValue

&nbsp;&nbsp;&nbsp;&nbsp;RedValue = (color And &HFF&
&nbsp;&nbsp;&nbsp;&nbsp;GreenValue = (color And &HFF00& \ 256
&nbsp;&nbsp;&nbsp;&nbsp;BlueValue = (color And &HFF0000) \ 65536
&nbsp;&nbsp;&nbsp;&nbsp;Convert2Hex = Format(Hex(RedValue) & Hex(GreenValue) & Hex(BlueValue), "000000")
End Function

And simply call it like this:

'shows message box with hex color value
MsgBox Convert2Hex(CommonDialog1.Color)

Enjoy!

JakeB
Paranoid (IV) Inmate

From: us
Insane since: Oct 2000

posted posted 03-23-2001 17:20

thats just what i wanted. Sometimes it doesn't give 6 chars even if you don't use a 0. Is it ok to only use like a 3 or 4 character hex color on a webpage? i've seen it done only once.

Allewyn
Maniac (V) Mad Scientist

From: Solitary confinement
Insane since: Feb 2001

posted posted 03-23-2001 17:26

Got good things to say about Beauty. Use it exclusively now

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 03-23-2001 23:18

JakeB, I would suggest you to always use complete hex color values (six places - #RRGGBB). Simplified versions that contain only three places can be used in CSS, but I wouldn't recommend you to use them there (FYI In simplified version two places are the same, AABBCC -> ABC)

Allewyn, I'm glad that you like MAX's HTML Beauty++ ME!

JakeB
Paranoid (IV) Inmate

From: us
Insane since: Oct 2000

posted posted 03-24-2001 00:24

then what should i do cause your code doesn't always give 6 charactors, sometimes it gives 6, somtimes 4, somtimes3.

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 03-24-2001 01:07

Hmm, I wonder how is that possible, Format() should add additional zeroes!? Anyway, for what RGB values you get 4 and 3 chars? Also, maybe you should try a different approach - store hex values for R, G, B values in separate strings and then check if string length is 1 and in that case add additional 0 in front and finally assemble those three string together...

JakeB
Paranoid (IV) Inmate

From: us
Insane since: Oct 2000

posted posted 03-24-2001 06:11

heres some rgb then the hex it gave me
12, 13, 54 = CD36
255, 128, 0 = FF800
5, 128, 192 = 580C0
12, 12, 12 = CCC

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 03-24-2001 08:16

Hmmm, I really don't know why Format() doesn't do anything. It seems that you're left with second option (three separate strings for each hex value, check for their length, add zeroes, assemble them together)...



[This message has been edited by mr.maX (edited 03-24-2001).]

« BackwardsOnwards »

Show Forum Drop Down Menu