color names

N

Nalaka

Hi....
When I pick colors using the design mode.... it puts c"color names" into the
markup.
Then in the "HTML mode"... shows a lot of color related errors.

How do I get the gui editor to put colors numbers instead (of names)?

any help is appreatiated
Nalaka
 
S

Steve C. Orr [MVP, MCSD]

I had similar problems. Depending on what you're doing exactly you may be able to use this function I patched together that converts colors to their hex values so they'll be more browser friendly.

Public Function Color2Hex(ByVal clr As Color) As String

Dim HexR, HexB, HexG As String



Try

'Get Red Hex

HexR = Hex(clr.R)

If Len(HexR) < 2 Then HexR = "0" & HexR



'Get Green Hex

HexG = Hex(clr.G)

If Len(HexG) < 2 Then HexG = "0" & HexG



'Get Blue Hex

HexB = Hex(clr.B)

If Len(HexB) < 2 Then HexB = "0" & HexB



Catch ex As Exception

Return ""

End Try



Return "#" & HexR & HexG & HexB 'Output complete hex

End Function
 
N

Nalaka

Thanks a bunch Steve.....
I had similar problems. Depending on what you're doing exactly you may be able to use this function I patched together that converts colors to their hex values so they'll be more browser friendly.

Public Function Color2Hex(ByVal clr As Color) As String

Dim HexR, HexB, HexG As String



Try

'Get Red Hex

HexR = Hex(clr.R)

If Len(HexR) < 2 Then HexR = "0" & HexR



'Get Green Hex

HexG = Hex(clr.G)

If Len(HexG) < 2 Then HexG = "0" & HexG



'Get Blue Hex

HexB = Hex(clr.B)

If Len(HexB) < 2 Then HexB = "0" & HexB



Catch ex As Exception

Return ""

End Try



Return "#" & HexR & HexG & HexB 'Output complete hex

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top