RGBColor[{red channel, green channel, blue channel}]
defines a color. Here is a didactic example of this:
mix[r_, g_, b_] := If[Max[{r, g, b}] > 0, RGBColor[{r, g, b}/Max[{r, g, b}]], RGBColor[{0, 0, 0}]]
Manipulate[
Graphics[{
mix[r, g, b],
Rectangle[]
}],
{r, 0, 100, 1}, {g, 0, 100, 1}, {b, 0, 100, 1}
]
{r,g,b}
has been normalized so that the largest component is 1, because values larger than 1 are clipped by Mathematica.
For your complicated example, you simply have to write RGBColor[{3,2,5}/5]
.
Try typing Cyan
into Mathematica. It will return RGBColor[0, 1, 1]
. So the result of mixing 2 X blue plus 1 X cyan is RGBColor[(2 {0, 0, 1} + {0, 1, 1})/3]
.
Mathematica helps you mix colors with the function Blend
. For example Blend[{Blue, Cyan}, 1/3]
returns RGBColor[0, 1/3, 1]
which is exactly what the computation above returns.
There is also CMYKColor
which works the same way, but instead of specifying red, green and blue components we specify cyan, magenta, yellow and black.