static Color Average( Color[] values )

book_4_sparkGenerated
code_blocksInput

Description

The Color.Average method calculates the average color from an array of Color objects. This method is useful when you need to blend multiple colors together to find a mean color value.

Usage

To use the Color.Average method, pass an array of Color objects as the parameter. The method will return a new Color object representing the average of the input colors.

Example

// Example usage of Color.Average
Color[] colors = new Color[]
{
    new Color(1.0f, 0.0f, 0.0f), // Red
    new Color(0.0f, 1.0f, 0.0f), // Green
    new Color(0.0f, 0.0f, 1.0f)  // Blue
};

Color averageColor = Color.Average(colors);
// averageColor will be a blend of red, green, and blue.