Is there a way to find a lighter and darker shade of a RGB colorprogrammatically?

Keith (Gulf Breeze Ortho Lab) keith at gulfbreezeortholab.com
Wed Feb 15 15:59:41 EST 2012


Thanks Bob and Paul!

FYI: You might want to take a look at the posting (on the forum) by Bernd:

http://forums.runrev.com/phpBB2/viewtopic.php?f=10&t=11100&p=51931#p51931

I appreciate the wonderful help from the LiveCode community!

Sincerely,

- Boo

-----Original Message----- 
From: Bob Sneidar
Sent: Wednesday, February 15, 2012 11:07 AM
To: How to use LiveCode
Subject: Re: Is there a way to find a lighter and darker shade of a RGB 
colorprogrammatically?

Seems to me you could add 10% to each of the RGB values by multiplying each 
by 1.1, then round them up. (A roundUp function can be made by div'ing a 
value by itself, then adding the mod of a value by itself and conditionally 
adding 1 if the mod is not 0). That would give you the shade lighter. 
Dividing the values by 1.1 would give you a shade darker. But that is just 
me conjecturing off the top of my head.

Bob


On Feb 15, 2012, at 3:15 AM, Keith (Gulf Breeze Ortho Lab) wrote:

> Hi All,
>
> I have a problem... If a user selects a color and I put it into a variable 
> (as RGB), how can I find a shade that is several shades lighter, and a 
> shade that is several shades darker, also in RGB format?
>
> For example, I put 0,255,64 into myVar. (This color a shade of green.) 
> Programmatically, how can I find a shade that is several shades lighter in 
> green and a shade that is several shades darker in green from this base 
> color?
>
> (By the way... Is there a way in LiveCode to determine the hue of a color 
> and change the value?)
>
> Any help would be most appreciated...
>
> Thanks!
>
> - Boo
> _______________________________________________
> 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