Complementary RGB Color Pairs
Wilhelm Sanke
sanke at hrz.uni-kassel.de
Mon Feb 26 17:00:55 EST 2007
On Mon, 26 Feb 2007, Stephen Barncard <stephenREVOLUTION at barncard.com>
wrote:
> Thanks to all who responded. I was turned onto a lot of information
> about color. I guess the upshot is that a simple compliment -
> literally - will do what I wanted - subtracting 255 from each part of
> the color array. This is what I came up with: FUNCTION complimentColor
> pTrio REPEAT for each item tITEM in pTrio put abs(tITEM - 255) & comma
> after tOut END REPEAT delete last char of tOut return tOut END
> complimentColor
>
>>>
>>>For those who do not want to bother to download a big stack just for
>>>the matter of a few script lines
>>>here is the script of btn "complementary colors" that at least gives
>>>you a hint how to proceed to find out
>>>complementary color triplets:
>>>
>>>"on mouseUp
>>> set the cursor to watch
>>> put the milliseconds into Start
>>> put the imageData of image 2 into iData
>>> put 0 into counter
>>> repeat for each char C in idata
>>> add 1 to counter
>>> put numtochar(255 - chartonum(C)) into char counter of idata
>>> end repeat
>>> set the imageData of image 2 to iData
>>> put the milliseconds - Start into fld "test"
>>>end mouseUp"
>>>
>>>Regards,
>>>
>>>Wilhelm Sanke
>
> stephen barncard s a n f r a n c i s c o
As always, there are multiple ways to achieve identical results - that's
one of the interesting facets of programming. "abs(tITEM - 255)" - as in
your function above - produces the same result as "255 - tItem", but if
you put 255 in front you do not need the correcting workaround "abs". --
Wilhelm Sanke <http://www.sanke.org/MetaMedia>
More information about the use-livecode
mailing list