Thanks that could be useful... BTW where to you store this kind of snippet

We need an online repository for scripts like this... something simpler than 
GIT,

Actually determining the luminance algorithm is pretty straight forward... even 
easier than this formula.. but how do you get the color a specific pixel in an 
image?


BR


On February 18, 2016 at 4:27:29 PM, J. Landman Gay 
(jac...@hyperactivesw.com<mailto:jac...@hyperactivesw.com>) wrote:

I'm not sure about getting an average, but someone posted the following
handler here a while ago. I'm sorry I can't give credit, I should have
saved that.

Determine whether to show white or black text against a colored background:

function calcLuminance pRGB
-- wikipedia: Y = 0.2126 R + 0.7152 G + 0.0722 B
put item 1 of pRGB * 0.2126 into tR
put item 2 of pRGB * 0.7152 into tG
put item 3 of pRGB * 0.0722 into tB
if sum(tR,tG,tB) > 125 then return "black"
else return "white"
end calcLuminance
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to