Given a RGB color x, how to find the most contrasting color y?

Posted by Arthur Wulf White on Game Development See other posts from Game Development or by Arthur Wulf White
Published on 2012-10-08T12:57:32Z Indexed on 2012/10/08 15:54 UTC
Read the original article Hit count: 271

I have to mark a certain item in a way that will make it stick-out in the background. I need it to be surrounded with the color that contrasts the background as much as possible so it will pop out and easily noticeable by the player.

Lets say I know the background is color 'x', how do I find 'y' such that it will be very contrasting to 'x' and easy to notice in a background where 'x' is a dominant color?

I first thought about inverting color 'x' and then I noticed that when 'x' is a medium shade of gray, if I invert 'x' to get 'y', then 'y' is also a medium shade of gray which does not work.

© Game Development or respective owner

Related posts about graphics-programming

Related posts about color