"lightening" a color
J. Landman Gay
jacque at hyperactivesw.com
Sat Sep 10 22:37:07 EDT 2016
On 9/10/16 5:00 PM, Dr. Hawkins wrote:
> Is there a way to "lighten" a color.
This showed up on the list some time ago:
function lightenColor origColor
try
repeat with i = 1 to 3
add 50 to item i of origColor
if item i of origColor > 255 then put 255 into item i of origColor
if item i of origColor < 0 then put 0 into item i of origColor
end repeat
return origColor
catch tSomeErr
return origColor
end try
end lightenColor
I also made this note from StackOverflow, which I haven't quite wrapped
my head around yet:
For combining 2 colours using RGB values, there are 2 ways.
If you need a lighter texture, the formulae you need to use is (r1,
g1, b1) + (r2, g2, b2) = (min(r1+r2, 255), min(g1+g2, 255), min(b1+b2, 255))
If you need a slightly darker texture , use (r1, g1, b1) + (r2, g2,
b2) = ((r1 + r2) / 2, (g1 + g2) / 2, (b1 + b2) / 2)
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list