Reputation: 11
is there any way of flipping colors of image to its equivalent at the opposite side of spektrum. Like you have a color white, than it flips to black, blue to yellow etc. Thanks for answer.
Upvotes: 0
Views: 93
Reputation: 56
It's very simple.
First, we need to discuss what Opposite Color is.
Please see the Wikipedia article for details.
In short, complementary colors are two colors that, when mixed, result in a perfect white color.
In RGB Color(0~255), white is (255, 255, 255).
For example, let's say you want to find the complementary color of blue. The RGB color of blue is (0, 0, 255) , so its complementary RGB value is (255, 255, 0), yellow.
Let's express what i've said so far in UnityScript.
Note: unity use normalized range.(as 0-1)
private Color GetOppositeColor(Color color)
{
return new Color(1f - color.r, 1f - color.g, 1f - color.g);
}
Upvotes: 1