Description
The Color32.Max
method is a static method that returns a new Color32
instance. This instance is created by comparing two Color32
objects, a
and b
, and selecting the maximum value for each color component (red, green, blue, and alpha) from the two colors. This method is useful for determining the brightest or most opaque color when comparing two colors.
Usage
To use the Color32.Max
method, you need to pass two Color32
objects as parameters. The method will return a new Color32
object with each component (r, g, b, a) set to the maximum value found in the corresponding components of the input colors.
Example
// Example usage of Color32.Max method
Color32 color1 = new Color32 { r = 100, g = 150, b = 200, a = 255 };
Color32 color2 = new Color32 { r = 120, g = 140, b = 210, a = 240 };
Color32 maxColor = Color32.Max(color1, color2);
// maxColor will have the values:
// r = 120, g = 150, b = 210, a = 255