When mixing blue and yellow paint, the result is some sort of green.
I have two rgb colors:
blue = (0, 0, 255)
and yellow = (255, 255, 0)
What is the algorithm for finding the rgb color that is the result of mixing the two colors, as they would appear when using paint? The resulting colors from the algorithm does not have to be terribly exact. For the example above it would only have to look like some sort of green.
Thanks in advance.
Edit: This function, written in Go, worked for me, based on the answer from LaC.
func paintMix(c1, c2 image.RGBAColor) image.RGBAColor {
r := 255 - ((255 - c1.R) + (255 - c2.R))
g := 255 - ((255 - c1.G) + (255 - c2.G))
b := 255 - ((255 - c1.B) + (255 - c2.B))
return image.RGBAColor{r, g, b, 255}
}
Edit #2 Allthought this manages to mix cyan and yellow, the mix between blue and yellow becomes black, which doesn't seem right. I'm still looking for a working algorithm.
Edit #3 Here's a complete working example in Go, using the HLS colorspace: http://go.pastie.org/1976031. Thanks Mark Ransom.
Edit #4 It seems like the way forward for even better color mixing would be to use the Kubelka-Munk equation