Returns a color representing the specified RGB value, and throws an exception if the file does not support the specified color.

 public Color GetColor(int red, int green, int blue)
Public Function GetColor(ByVal red As Integer, ByVal green As Integer, ByVal blue As Integer) As Color

The red component of the desired color. Must be between 0 and 255.

the green component of the desired color. Must be between 0 and 255.

the blue component of the desired color. Must be between 0 and 255.

A object representing the color with the specified RGB value.

If the given red, green, or blue value is not between 0 and 255.

For .xls files, an exception will be thrown if no color in the palette has the specified RGB value. For .xlsx files, a color will be returned for any RGB values.

Color blue = pal.GetColor(0, 0, 255);
Dim blue As Color = pal.GetColor(0, 0, 255)