Color color = Color.FromArgb(255, 128, 0); float brightness = color.GetBrightness(); Console.WriteLine("The brightness of the color is {0}.", brightness);
ListThis example constructs a list of colors and then iterates through them, calling the GetBrightness method on each color object and printing the output to the console. This example demonstrates how the GetBrightness method can be used in a loop to obtain the brightness of multiple colors. Package Library: The System.Drawing.Color class is a part of the .NET Framework, which is a package library developed by Microsoft.colors = new List { Color.Red, Color.Blue, Color.Green, Color.Yellow, Color.Black, Color.White }; foreach (Color color in colors) { float brightness = color.GetBrightness(); Console.WriteLine("The brightness of the color {0} is {1}", color.Name, brightness); }