Returns the closest color to the specified color that the file can support.

 public Color GetClosestColor(System.Drawing.Color color)
Public Function GetClosestColor(ByVal color As System.Drawing.Color) As Color

The desired color.

The closest color in the palette to the specified RGB value

For .xls files, this will be the color in the palette that has the minimum difference between the specified RGB value and its RGB value. .xlsx files are not limited to colors in the palette, and will return a Color representing the specified color exactly.

Color clr = pal.GetClosestColor(System.Drawing.Color.Red);
Dim clr As Color = pal.GetClosestColor(System.Drawing.Color.Red)