Short: Convert #rrggbb <-> HTML color names Author: Gabriele Favrin (favrin@tin.it) Requires: Kickstart 2.04 or better Version: 1.0 LEGAL STUFF The author is in no way responsible for moral and/or material damages that his program may cause to people or things. The programmer gave his best to limit the problems that this tool may cause, but he is not able to guarantee its efficiency in all the situations. Using this program, you, the user, are responsible for all moral, material, civil and penal things. WHAT DOES IT DO h2c stands for "html to color", "hex to color" which ever you prefer to help you remember the name. It is a program that convert HTML color names to their respective #rrggbb hex values and vice versa. The use of color names instead of #rrggbb values has been spread by PC browser developers and you know how some people think... "if it works on MY browser it will work on any". This is false: if a browser doesn't support a color name it will ignore the color definition and this can create problems with the page readability. Although all major browsers now support a large set of color name definitions it is still a good idea to use rgb values, at least for pages that will be spread over the net. On the other hand, while developing is easier to remember a string like "yellow" than one like "#FFFF00". :-) h2c was born exactly for this reason: while I edit I often use color names, then I convert them to #rrggbb values at end of my work. It was boring to search the loooong table every time (there are 744 color names!) so I decided to write something that does that task for me. USAGE h2c can be run only from shell. Available options are: COLOR,LS=LIST/S,NA=NOALIAS/S,S=STRICT/S: COLOR This option allows you to specify a color name or #rrggbb hex code. In case of color name the matching hex value will be displayed. If a hex value is given, h2c will display all color names matching that value (ie. the name and its aliases). To specify an #rrggbb hex code, put character # or $ before the value itself (some shell like csh have problem with "#" character, they interpret it as a wildcard, in these cases use $). Note: HTML color names may contain spaces. h2c (and most browsers) will remove them. Also capital characters are changed. LIST or LS This option shows a list of all color names and their hex values. NOALIAS or NA This option causes both LIST and search functions to return only a single match for each color (ie. no multiple names for the same color value). STRICT or S This option causes h2c to recognize only the few colors officially defined by W3C (the group that develops HTML). h2c can be stopped by pressing control+c. The results are showed as a list composed of one or more items displayed in the following format: html color name #rrggbb hex value type types: W3C HTML - the color has been officially defined. NHTML - the color has been defined in some browsers (like Netscape). ALIAS - the color is an alias of another color name. For example all colors containing the "grey" word are aliases of colors containing the "gray" word. Examples: -> h2c LIST display the entire color table. -> h2c LIST NOALIAS display the color table except aliases. -> h2c $ffffff display all colors names that represents the color value $ffffff -> h2c $ffffff STRICT display only "white", that is the officially defined color name for value $ffffff -> h2c #ffffff STRICT the same as above but using the proper HTML way of specifying numeric values. THANKS and CREDITS This program is based on the AWeb color table. Thanks to Yvon Rozijn for it! FUTURE Any suggestions, bug reports or critics are welcome! Write me at: E-Mail: favrin@tin.it FidoNet: 2:333/726.8 Please write in italian or english, thank you. Visit my new Home Page: http://freeweb.aspide.it/free/poing/index.htm HISTORY V0.1 (8.3.98) +First version. V1.0 (11.3.98) +Almost rewritten the program :-) +Reduced executable size by over 8k and improved search speed by changing the way color data is stored. +Now it is possible to use $ for specifying that the inserted HTML color is an hex value. This has been added to avoid confusion (for shells) between # and an wildcard. +Changed 'FILTER' to 'NOALIAS' and improved its functionality. +Various other internal changes. CHILDWARE This software is "CHILDWARE". The author explicitly asks whoever uses this program to make a donation to a beneficial corporate body which works helping children in some way. If you don't know of any, ask at your local post office and inform yourself on how to make a donation to UNICEF. The amount of the offer is up to you , but please do it!