Is there a way to find a lighter and darker shade of a RGB color programmatically?
bobs at twft.com
Wed Feb 15 11:07:27 CST 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.
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...
> - Boo
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode