RGB to HEX
Jeanne A. E. DeVoto
revolution at jaedworks.com
Thu Mar 2 13:28:14 EST 2006
At 9:44 AM -0800 3/1/2006, Garrett Hylltun wrote:
>Is there a built-in function in Rev that will convert RGB color
>string to a HEX color string? If no, does anyone know how to do
>this? I knew how to do this in another language, but am at a loss
>as to how to work it out in Rev.
Here's a code snippet:
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 zero before it -- each
component must be 2-digit
put it after theWebColor
end repeat
--
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com
More information about the use-livecode
mailing list