Evaluating RGB?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Evaluating RGB?

Post by teacherguy »

I would like to change the drop shadow behind text from black to white depending on the textcolor that the user selects. Does anyone have a way of evaluating the RGB in order to determine a darker color (say blue) from a lighter one (say yellow)?
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10509
Joined: Wed May 06, 2009 2:28 pm

Re: Evaluating RGB?

Post by dunbarx »

Hi.

Well, "0,0,0" is pretty light, and if you start increasing the values of any of the three RGB values, the color will get "darker".

But is full yellow darker than full red? No, I guess. I think it better if you limit the color options to a fixed set, and create a look-up table so that you can map one to the other as you desire.

Craig Newman
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Evaluating RGB?

Post by jacque »

I think you're looking for luminance values:

http://runtime-revolution.278305.n4.nab ... l#a4709206
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Evaluating RGB?

Post by teacherguy »

Superb, thanks Jacque
Post Reply