Thank you Eric, Mark and Sarah for fantastic help with this. I'm embarrassed to say that I only searched for HTML color, and concluded there wasn't anything to be found on this exactly. So thanks once again for pointing me in new directions.
Though I have to read up about how to use libs, I wouldn't have a clue atm! But I will find out, so need to reply re this. :) 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 - WHICH of course I won't be doing, so not really a problem! However I'm hoping this won't make any difference with the html output when it comes time to show the color on a webpage - I wonder if it will be the correct colour? I haven't had a chance to test out such colours, but I'm guessing (hoping) that it won't? Cheers, Heather ----- Original Message ----- From: "Sarah Reichelt" <[EMAIL PROTECTED]> To: "How to use Revolution" <[email protected]> Sent: Thursday, August 07, 2008 2:39 PM Subject: Re: HTML Color Codes > I was wondering how to translate the RGB names to the HTML equivalent when > user selects color with the Color Dialog. For such use as with a html page > generator. > > If it doesn't exist already (though surely it's been done before, and I > just can't find it): am I on the right track thinking that an array would > be used to hold both code sets, then a function returns the html > equivalent rather than the RGB? Or something! HTML colors are just the same as RGB colors but with the decimal numbers converted to hexadecimal and then run together. So you can calculate one from the other and don't need an array or lookup table. Here is a function for doing the conversion. function RGBtoHTML pRGB put item 1 of pRGB into r put item 2 of pRGB into g put item 3 of pRGB into b put baseconvert(r,10,16) into r put baseconvert(g,10,16) into g put baseconvert(b,10,16) into b return "#" & r & g & b end RGBtoHTML So you can do something like this: answer color put it into tRGBcolor put RGBtoHTML(tRGBcolor) into tHTMLcolor Cheers, Sarah _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
