How do I mix multiple colors into one color?

Let’s say I want one object to be the color of three mixed colors: red, yellow, pink. How would I do so?

This is a slightly bigger question than it sounds like as there are different methods of mixing colours; additive like light and subtractive like paint.

To get an additively mixed colour you could use an averaging function like so:

private Color AverageColour(Color[] colours)
    float totalRed = 0f;
    float totalGreen = 0f;
    float totalBlue = 0f;

    foreach (Color colour in colours)
        totalRed += colour.r;
        totalGreen += colour.g;
        totalBlue += colour.b;

    float numColours = colours.Length;
    return new Color(totalRed / numColours, totalGreen / numColours, totalBlue / numColours);