Scripting gradients

Guglielmo Braguglia guglielmo at braguglia.ch
Wed Sep 5 06:17:43 EDT 2012


John ... your values are already *RGB* values, just differently written 
... ;-)

E.g.  ... *#FF7F00* is made by three couples of values : FF (/the R 
value/) 7F (/the G value/) 00 (/the B value/) just written in 
hexadecimal ... convert to the decimal value and ... that's all.

So  #FF7F00  is just 255, 127, 0 :-)

Guglielmo


On 05.09.2012 11:58, John Allijn wrote:
> I think i can get it working, but i'm strugling with the color-coding.
> My colors are all in a hex format like #FFFFFF.
> How do I convert that to RGB values? I can't find a command for this in the help.
>
>
> On Sep 5, 2012, at 11:00, Scott Rossi <scott at tactilemedia.com> wrote:
>
>> Sorry, make that:
>>
>> put theArray["ramp"] into theVar   (no object reference needed)
>>
>>
>> Recently, I wrote:
>>
>>> Gradient settings are stored in an array property called the fillGradient.
>>> The color data is stored the "ramp" index.  So to get the colors, you could
>>> script something like:
>>> put the fillGradient of graphic "myBox" into theArray
>>> put theArray["ramp"] of graphic "myBox" into theVar
>>>
>>> The variable theVar will contain each color of the gradient, listed one per
>>> line.
>>>
>>> After making changes to the colors, you load the color data back into the
>>> array, and set the fillGradient of the graphic to the array:
>>> put theVar into theArray["ramp"]
>>> set the fillGradient of graphic "myBox" to theArray
>>>
>>> See the fillGradient entry in the dictionary for more info.
>>>
>>> Regards,
>>>
>>> Scott Rossi
>>> Creative Director
>>> Tactile Media, UX Design
>>>
>>>
>>>
>>> Recently, John Allijn wrote:
>>>
>>>> Hi,
>>>> I have a rectangle that I filled with a gradient in the inspector.
>>>> Is there a way to script the colors of this gradient?
>>>> I want to let the user pick a color for a color theme and have the gradient
>>>> match that.
>>>> Thanks!
>>>>
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription
>>>> preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription
>>> preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
>> Regards,
>>
>> Scott Rossi
>> Creative Director
>> Tactile Media, UX Design
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>




More information about the use-livecode mailing list