On Wed Feb, 2012, Keith (Gulf Breeze Ortho Lab) keith at
gulfbreezeortholab.com 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
The revcolorchooser stack (in folder Toolsets) contains the old
conversion scripts of Scott Raney "function RGBtoHSV r, g, b" and - the
other way round - "function HSVtoRGB h, s, v" (in group "HSV").
Convert you RGB color to HSV and to darken or brighten, just change the
V-value. For changing the hue values, use H.
Then convert your values back to RGB.
These procedures work rather slowly when you work with whole images and
not a single color.
A much faster solution is using "Quasimondo RGB-to-HSL and HSL-to-RGB
conversions"
<http://quasimondo.com/> and article "Converting RGB to HSL differently".
For brightening and darkening use the "luminance" value L.
Finally you could use my "brighten/darken" button of my old "Imagedata
Toolkit" <http://www.sanke.org/software/ImagedataToolkitPreview3.zip>
Best regards,
Wilhelm Sanke
_______________________________________________
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