Re: HTML Color Codes
Message: 26 Date: Thu, 7 Aug 2008 01:17:36 +1000 Hi Heather You will find a ColorConverter at www.FlexibleLearning.com/xtalk that does exactly what you describe. It's a Rev stack with lots of other info built into it including color-safe sets, RGBREVHTM equivalent names etc etc. /H Last one before I jump into bed and thaw out after sitting at a computer for hours... 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! Though I know hardly anything about arrays, never used them - only very vaguely know what they are and what they do. Kind of. As I'm off to bed, I'll read up on them, then doze off to the sound of a script typewriter clacking in my Rev-Brainwashed noggin. :D Tia and Goodnight til Oz morn! Cheers, Heather ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: HTML Color Codes
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 use-revolution@lists.runrev.com 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 use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: HTML Color Codes
By the way, this isn't a case where orange and red are equivalent, right? (tongue in cheek) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: HTML Color Codes
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 | [EMAIL PROTECTED] HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: HTML Color Codes
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. Will the numberFormat work with hexadecimal numbers? That was my mistake in the function Heather, but my solution would be: if the length of r 2 then put 0 before r And repeat this for g b before assembling the HTML color string. Cheers, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: HTML Color Codes
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. Will the numberFormat work with hexadecimal numbers? That was my mistake in the function Heather, but my solution would be: if the length of r 2 then put 0 before r And repeat this for g b before assembling the HTML color string. You can also use the format function to not only convert the R, B, and B numbers to hex, but pad it properly as well! put the backColor of this stack into tRGB -- 194,10,128 split tRGB by comma put format(%02x%02x%02x,tRGB[1],tRGB[2],tRGB[3]) into tHexColor put tHexColor -- c20a80 And with do, you can even do it in one line: put the backColor of this stack into tRGB -- 194,10,128 do put format( quote %02x%02x%02x quote , \ tRGB ) into tHexColor put tHexColor -- c20a80 BTW: format() cool and is great for padding zeroes or spaces in front things, so you can convert numbers to zero-padded fixed-length 6 digit numbers like this: put 5 into tNum put format(%06d,tNum)-- 05 Or if you need to pad spaces, you can omit the 0 in the format() call, so: put format(%6d,tNum) -- 5 (5 spaces, then the number 5) Have fun, Ken Ray Sons of Thunder Software, Inc. Email: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
HTML Color Codes
Last one before I jump into bed and thaw out after sitting at a computer for hours... 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! Though I know hardly anything about arrays, never used them - only very vaguely know what they are and what they do. Kind of. As I'm off to bed, I'll read up on them, then doze off to the sound of a script typewriter clacking in my Rev-Brainwashed noggin. :D Tia and Goodnight til Oz morn! Cheers, Heather ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: HTML Color Codes
If you would have searched for 'color' or 'rgb' using the Rev Search Engine Web database, you would have found: http://www.sweattechnologies.com/rev/ And Monte Goulding excellent library: libColor :-) Le 6 août 08 à 17:17, H Baric a écrit : 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. Best regards from Paris, Eric Chatonet. Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/ Email: [EMAIL PROTECTED]/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: HTML Color Codes
Heather- Wednesday, August 6, 2008, 8:17:36 AM, you wrote: 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. ...I'd point you towards Eric's own Color Picker plugin, which you can find at http://www.sosmartsoftware.com/?r=revolutionl=en -- -Mark Wieder [EMAIL PROTECTED] ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
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 use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution