Author |
Topic |
Freeman II
Junior Member
232 Posts |
Posted - 10 July 2001 : 23:07:47
|
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
|
#F5F5F5
Thanks,
Mo |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 10 July 2001 : 23:26:58
|
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 |
|
|
Freeman II
Junior Member
232 Posts |
Posted - 11 July 2001 : 16:41:00
|
im looking for a function that converts the color name to a hex value.
|
|
|
Id
Junior Member
USA
129 Posts |
Posted - 11 July 2001 : 17:58:37
|
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
|
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 11 July 2001 : 19:01:42
|
you could use an array to hold the values as well, if you don't want to involve a database. |
|
|
mafifi
Junior Member
USA
308 Posts |
Posted - 11 July 2001 : 21:34:40
|
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 |
|
|
Freeman II
Junior Member
232 Posts |
Posted - 11 July 2001 : 22:41:33
|
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
|
|
|
redbrad0
Advanced Member
USA
3725 Posts |
Posted - 12 July 2001 : 08:36:25
|
I believe that you need to go with what Id said....
Use a database
Brad |
|
|
mafifi
Junior Member
USA
308 Posts |
Posted - 12 July 2001 : 21:22:26
|
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 |
|
|
hwfranz
Starting Member
Germany
30 Posts |
Posted - 16 July 2001 : 11:55:59
|
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? |
|
|
jalberts
Starting Member
USA
32 Posts |
Posted - 16 July 2001 : 14:22:13
|
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 |
|
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 16 July 2001 : 15:01:26
|
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 |
|
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 16 July 2001 : 16:42:29
|
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 |
|
|
RichardKinser
Snitz Forums Admin
USA
16655 Posts |
Posted - 16 July 2001 : 17:07:44
|
Opera only supports the 16 colornames as specified in the HTML spec.
Netscape supports 140 colornames.
IE seems to support them all. |
|
|
wedont
Junior Member
Canada
344 Posts |
Posted - 16 July 2001 : 19:11:02
|
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 |
|
|
Topic |
|