Scripting shades of colors?

Michael Kristensen michael-kristensen at dsa-net.dk
Wed Oct 31 10:14:22 EDT 2012


Hi again

Also thanks to Dan Friedman for your script

Rolf Kocherhans pointed me to this stack by Bernd

http://forums.runrev.com/viewtopic.php?f=10&t=11100&p=51903&hilit=darken+lighten#p51903

Thanks to both

And now a special thanks goes to my mother who always believed in me and stood up for me :-)

Michael



> 
> Here is a function that I use to lighten a color.  You could modify this to get a darker color as well.  Hope it helps.
> 
> function lightenColor origColor
>  try
>    repeat with i = 1 to 3
>      add 50 to item i of origColor
>      if item i of origColor > 255 then put 255 into item i of origColor
>      if item i of origColor < 0 then put 0 into item i of origColor
>    end repeat
>    return origColor
>  catch tSomeErr
>    return origColor
>  end try
> end lightenColor
> 
> -Dan
> 
> 
>> Hi there
>> 
>> Lets say I have a color a,b,c
>> 
>> Now I want the same color but fx 10% darker and 10 % lighter.
>> 
>> (As if you in the colorwheel palette dragged the scrollbar-thumb a little down and a little up)
>> 
>> How could one script this?
>> 
>> Thanks
>> Michael
> 





More information about the use-livecode mailing list