# FindClosestColorInTable

int FindClosestColorInTable (int color, const int *colorTable, int tableSize);

## Purpose

Searches a table for the closest match to the specified color.

The closest matching color is determined by considering both the Pythagorean distance between colors in the RGB color cube and the ratios between the color components.

## Parameters

Input
Name | Type | Description
color | integer | The color for which to search the table for the closest match. The color is specified in RGB format. See the function panel for the User Interface Library MakeColor function for more information about RGB colors.
colorTable | const integer * | An array of integers in which each integer represents a color in RGB format. See the function panel for the User Interface Library MakeColor function for more information about RGB colors.
tableSize | integer | Pass the number of colors (integers) in the color table array.

## Return Value

Name | Type | Description
indexOfClosestColor | integer | Returns the zero–based index of the color in the table that most closely matches the specified color.