Using setFillColor's tint feature to change the color of an object to the exact one you want

is there some kind of formula/function to apply an specific tint to get the color you want in a pixel?

let’s say I have a greenish (0, 100, 0)  square and I want to turn it red (255, 0, 0)

if I use setFillColor(255,0,0) on the greenish square it won’t turn it to the bright red… instead it will be darker. 

is there a formula I can apply to convert that?

There’s a comment in the blog: Tints and Gradients | Corona Labs where it states:

Does it tint individual pixels proportionally based on their RGB value? For example, if you have a pixel colored (255,195,105) (a light orange) and you tint it (85,170,255) [that’s (33%,66%,100%)] would the final color would be (85,130,105)?

and Walter replies that it’s correct, however I don’t seem to be able to grasp the mathematics of this in order to convert it to a function in lua… any help?

Until now there isn’t a way to do that. But that should changes with the Graphics 2.0 update.

What you could try is to convert your graphic into grayscale. Then you can use setFillColor to give it it’s normal green color or any other that you want.

Until now there isn’t a way to do that. But that should changes with the Graphics 2.0 update.

What you could try is to convert your graphic into grayscale. Then you can use setFillColor to give it it’s normal green color or any other that you want.