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

Bob Sneidar bobs at twft.com
Wed Feb 15 12:07:27 EST 2012


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





More information about the use-livecode mailing list