Arul.rajesh
Active Member
- Joined
- Sep 20, 2011
- Messages
- 285
Need help to calculate the contrasting colors for given set of RGB values.
For a
<code>
sub contrast()
r=127
g=127
b=127
activecell.font.color=RGB(r,g,b)
new_r=255-r
new_g=255-g
new_b=255-b
activecell.interior.color=RGB(new_r,new_g,new_b)
end sub
</code>
does not help when r,g,b values near 127 or 128 as they are more or less grey.
I need a formula that would give me values of new_r, new_g and new_b that would be in contrast with RGB(r,g,b) for any values of r,g,b from 0-255
For a
<code>
sub contrast()
r=127
g=127
b=127
activecell.font.color=RGB(r,g,b)
new_r=255-r
new_g=255-g
new_b=255-b
activecell.interior.color=RGB(new_r,new_g,new_b)
end sub
</code>
does not help when r,g,b values near 127 or 128 as they are more or less grey.
I need a formula that would give me values of new_r, new_g and new_b that would be in contrast with RGB(r,g,b) for any values of r,g,b from 0-255