Colors conversion (was [INFO] Javascript Colors list)

Thomas McGrath III 3mcgrath at adelphia.net
Sat May 28 10:57:55 EDT 2005


Eric,

very cool, your the man......

Tom
On May 28, 2005, at 3:48 AM, Eric Chatonet wrote:

> Hi Tom,
>
> From my Color Picker plugin, here are some functions that may help:
>
> function AnyColorToRGB pColor
>   if comma is not in pColor then
>     put ColorNameToRGB(pColor) into pColor -- Æ
>     if pColor = empty then
>       put HTMLToRGB(pColor) into pColor -- Æ
>     end if
>   end if
>   return pColor
> end AnyColorToRGB
> -----------------------------
> function ColorNameToRGB pColorName
>   local tColors
>   ------
>   if pColorName is not among the lines of the colorNames then return 
> empty
>   put the uColors of this stack into tColors
>   filter tColors with pColorName & ",*"
>   return item 2 to 4 of tColors
> end ColorNameToRGB
> -----------------------------
> function HTMLToRGB pHtmlRef
>   if char 1 of pHtmlRef is "#" then delete char 1 of pHtmlRef
>   -----
>   return baseconvert(char 1 to 2 of pHtmlRef,16,10) & comma \
>       & baseconvert(char 3 to 4 of pHtmlRef,16,10) & comma \
>       & baseconvert(char 5 to 6 of pHtmlRef,16,10)
> end HTMLToRGB
>
> The uColors property returns a list of the color names followed by the 
> rgb values.
> I am going to post it separately in 2 mails because of the mail size 
> limits on this list...
>
> If you need another functions as RGBToHTML, RGBToColorName, etc. let 
> me know :-)
>
> Le 28 mai 05 ˆ 05:33, Thomas McGrath III a Žcrit :
>
>> I did write a small script to get the RGB equivalent of those names 
>> and posted the results. Maybe there is a function for that?
>> I didn't find a way to do the HTML Hex values though. Any ideas?
>
>
> Best regards from Paris,
>
> Eric Chatonet.
> ----------------------------------------------------------------
> So Smart Software
>
> For institutions, companies and associations
> Built-to-order applications: management, multimedia, internet, etc.
> Windows, Mac OS and Linux... With the French touch
>
> Plugins, tutorials and more on our website
> ----------------------------------------------------------------
> Web site        http://www.sosmartsoftware.com/
> Email        eric.chatonet at sosmartsoftware.com/
> Phone        33 (0)1 43 31 77 62
> Mobile        33 (0)6 20 74 50 86
> ----------------------------------------------------------------
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>

Thomas J. McGrath III
SCS
1000 Killarney Dr.
Pittsburgh, PA 15234
412-885-8541



More information about the use-livecode mailing list