Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 html question
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Freeman II
Junior Member

232 Posts

Posted - 10 July 2001 :  23:07:47  Show Profile
how do i convert a color name to a hex value?

ex: whitesmoke to #ABCDEF

mafifi
Junior Member

USA
308 Posts

Posted - 10 July 2001 :  23:23:31  Show Profile  Send mafifi an ICQ Message
#F5F5F5

Thanks,

Mo
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 10 July 2001 :  23:26:58  Show Profile
Are you looking for a function or something to do it for you, or do you just need to know the HEX equivalent to a colorname?

Here is a table with the colornames and their corresponding HEX codes:

http://www.one-service.com/tipsnhints/colrnumb.html
Go to Top of Page

Freeman II
Junior Member

232 Posts

Posted - 11 July 2001 :  16:41:00  Show Profile
im looking for a function that converts the color name to a hex value.

Go to Top of Page

Id
Junior Member

USA
129 Posts

Posted - 11 July 2001 :  17:58:37  Show Profile  Visit Id's Homepage
You could probably code yourself up some sort of a database, with all the values, then all you'd have to do is something like this


Function convertcolor(dcnDB, colorname)
SQL = "Select * From ColorTable where ColorName='" & colorname & "'"
set rsColor = dcnDB.Execute(SQL)
Set convertcolor = rsColor
End Function


The only other way i can think of doing it is with a whole bunch of if then statements within your function

i.e.


Function convertcolor(colorname)
If colorname = "whitesmoke" Then
newcolor = "#ABCDEF"
ElseIf colorname = "slategrey" Then
newcolor = "#FEDCBA"
ElseIf
.
.
.
End If
Set convertcolor = newcolor
End Function


I'm not sure why you'd wnat to though, because all the colors on the table richard showed are acceptable values in html, but aside form programming up something yourself through either method, I don't know what to tell you

Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 11 July 2001 :  19:01:42  Show Profile
you could use an array to hold the values as well, if you don't want to involve a database.
Go to Top of Page

mafifi
Junior Member

USA
308 Posts

Posted - 11 July 2001 :  21:34:40  Show Profile  Send mafifi an ICQ Message
I kinda of missed the question the first time. I think what Freeman II's questions is how would someone convert from a color name to the hex value. Similar to using your calculator to convert from HEX to RGB. I think the closest answer to his question is the link provided by Richard.

Thanks,

Mo
Go to Top of Page

Freeman II
Junior Member

232 Posts

Posted - 11 July 2001 :  22:41:33  Show Profile
thanks mafifi thats exactly what i meant
hope someone will figure this out soon

quote:

I kinda of missed the question the first time. I think what Freeman II's questions is how would someone convert from a color name to the hex value. Similar to using your calculator to convert from HEX to RGB. I think the closest answer to his question is the link provided by Richard.

Thanks,

Mo



Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 12 July 2001 :  08:36:25  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
I believe that you need to go with what Id said....

Use a database

Brad
Go to Top of Page

mafifi
Junior Member

USA
308 Posts

Posted - 12 July 2001 :  21:22:26  Show Profile  Send mafifi an ICQ Message
I think the question still is there a conversion tool or method that tells me that for example Cyan = #FF00FF and Light Cyan = #E0FFFF ?

Thanks,

Mo
Go to Top of Page

hwfranz
Starting Member

Germany
30 Posts

Posted - 16 July 2001 :  11:55:59  Show Profile  Visit hwfranz's Homepage
the simpliest way ist to make an example html page using "whitesmoke" as background color. Then make a screenshot and check the color with your grafic-tool (i.e photo shop).

Would this help a little?
Go to Top of Page

jalberts
Starting Member

USA
32 Posts

Posted - 16 July 2001 :  14:22:13  Show Profile  Visit jalberts's Homepage  Send jalberts an ICQ Message
There are a lot of JavaScript color tables out there that will probably do what you need with a little modification. I've used a couple that display colors to the user, they click on one to set their color preference, or to display the RGB value. With a little searching you could probably find one that has the plain text in them as well.

Jeff Alberts
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 16 July 2001 :  15:01:26  Show Profile  Visit gor's Homepage
quote:

thanks mafifi thats exactly what i meant
hope someone will figure this out soon

quote:

I kinda of missed the question the first time. I think what Freeman II's questions is how would someone convert from a color name to the hex value. Similar to using your calculator to convert from HEX to RGB. I think the closest answer to his question is the link provided by Richard.

Thanks,

Mo






This probably doesn't help, but it is what I used: Use Frontpage 2000
If you enter a named color there it shows you the hex-code.

Or take a look here: http://web.singnet.com.sg/~xymedia/javascript/color.html for a Javascript that can be used online without the use of color names.

I don't think there is a simple function that converts any color name to it corresponding hex value though, even Frontpage probably just hardcoded them.


Pierre
Join the Snitz WebRing
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 16 July 2001 :  16:42:29  Show Profile  Visit gor's Homepage
quote:

Here is a table with the colornames and their corresponding HEX codes:

http://www.one-service.com/tipsnhints/colrnumb.html



LOL

Richard, I just took a look at that page, and I learned a lot of new colornames.
I wonder who comes up with names like "saddlebrown" (that one I could understand), "peachpuff" (?), "peru" (??), "ghostwhite" , "honeydew" and "papayawhip"
BTW, I'm positive that Netscape and Opera don't support the ones mentioned here

Pierre
Join the Snitz WebRing
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 16 July 2001 :  17:07:44  Show Profile
Opera only supports the 16 colornames as specified in the HTML spec.

Netscape supports 140 colornames.

IE seems to support them all.
Go to Top of Page

wedont
Junior Member

Canada
344 Posts

Posted - 16 July 2001 :  19:11:02  Show Profile
Here's a small color tool (both Hex: RGB and decimals), I use it every day. (With a shortcut in my lower bar)
Colorpad (It's free!)
http://www.entic.net/~vmoya/downloads.html

Enjoy!

Wedont
snitz ver3.1 sr2

ps I still think that Snitz should have a section for usefull tools !


Edited by - wedont on 16 July 2001 19:13:34
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07