HTML Colors

Jeanne A. E. DeVoto revolution at jaedworks.com
Tue Jun 29 00:42:46 EDT 2004


At 12:36 AM -0400 6/29/2004, Simon Lord wrote:
>How can I turn 0,0,0 into #000000 or 255,255,255 into #FFFFFF? 
>Anyone have the secret for converting rgb to webcolors?

Web colors are just 3 base-16 numbers, one for each item of the RGB 
numeric color:

  put "#" into theWebColor -- leading "#"
  repeat for each item myItem in theColorNumber -- numeric triplet - R,G,B
     get baseConvert(myItem,10,16)
     if the length of it is 1 then put "0" before it  -- each 
component must be 2-digit
     put it after theWebColor
   end repeat

-- 
jeanne a. e. devoto ~ jaed at jaedworks.com
http://www.jaedworks.com


More information about the metacard mailing list