Admin Production ni-theme
Current Publication

FindClosestColorInTable

LabWindows/CVI

FindClosestColorInTable

int FindClosestColorInTable (int color, const int *colorTable, size_t 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 int 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 int * 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 size_t Pass the number of colors (integers) in the color table array. This number cannot exceed INT_MAX values.

Return Value

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

Additional Information

Library: Programmer's Toolbox

Include file: toolbox\toolbox.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later