Shades of Color
Dar Scott
dsc at swcp.com
Wed Oct 9 17:32:28 EDT 2002
On Wednesday, October 9, 2002, at 03:32 PM, Dan Friedman wrote:
> Does anyone know the algorithm to get a "Lighter" version of a RGB value?
> For example, if you have a RGB value of a shade of Green (0,176,23), and
> you
> want a version of this color that is 25% lighter (ie 25% more white).
>
> Any thoughts?
Maybe you can mix it with white.
Assume a color RGB vector, then...
lighterShadeOfGreen = (1-x) times shadeOfGreen + x times white
where x is, say, .25
This will move the color 25% of the way toward white, I think. This would
be in a straight line in RGB space. I have no idea whether this is
equivalent to what Sarah suggested. The two methods might take different
paths to white for all I know.
(The product of a number times a vector is the vector with each component
multiplied by the number. In terms of the RGB color this means taking each
of R, G and B and multiplying by the number. To add two vectors, add the
components. When arithmetic is all done, round each R, G and B to a whole
number and limit to the 0 to 255 range. If you need several colors, do all
the calculations and then round.)
Dar Scott
More information about the use-livecode
mailing list