HTML Color Codes

J. Landman Gay jacque at hyperactivesw.com
Sat Aug 9 14:05:03 EDT 2008


H Baric wrote:

> Sarah I had no idea the numbers were related like that, interesting thanks 
> for explaining. I tried out your function and mostly it worked, but 
> sometimes it outputs a less-than-6-digit html color which causes an error 
> when setting the backcolor of say a button to tHTMLcolor

Take a look at the "numberformat" property. This property sets the 
number of digits both before and after a decimal point. There are lots 
of options, but the most important thing to remember is that it will not 
work unless you perform a mathematical action on the variable. If you 
don't want to change the variable's value, just add zero to it:

   put baseconvert(r,10,16) into r
   set the numberformat to "00"
   add 0 to r

This gives you a two-digit number in all cases.
-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list