---
title: "ColorPalette..::.FindNearestIndex Method "
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_ColorPalette_FindNearestIndex_1_99a0633e.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# ColorPalette.FindNearestIndex Method 
 
Searches index of the color closest to given one.
 
**Namespace:** [Aurigma.GraphicsMill](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public Function FindNearestIndex ( _color As RgbColor _
) As Integer
```
 
```csharp
public int FindNearestIndex(RgbColor color
)
```
 
### Parameters
 
 - color
     - Type: [Aurigma.GraphicsMill.RgbColor](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_RgbColor.htm.md)
Color value to find.
 
### Return Value
Index of the palette entry which is closest to given color value.
 
## Examples
  
```
Dim red As Aurigma.GraphicsMill.RgbColor = _
 Aurigma.GraphicsMill.RgbColor.Red

Dim index As Integer = palette.FindNearestIndex(red)

Console.WriteLine(index)
```
 
```csharp
Aurigma.GraphicsMill.RgbColor red = Aurigma.GraphicsMill.RgbColor.Red;

int index = palette.FindNearestIndex(red);

Console.WriteLine(index);
```
   
## See Also

### Reference

- [ColorPalette Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorPalette.htm.md)
- [Aurigma.GraphicsMill Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill.htm.md)
