---
title: "ColorPalette Class"
canonical: https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_ColorPalette.htm
product: "Graphics Mill"
---

# ColorPalette Class
 
Represents a palette, i.e. an array of color values.
 
**Namespace:** [Aurigma.GraphicsMill](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```csharp
public sealed class ColorPalette : IEnumerable<RgbColor>, IDisposable
```
 
## Remarks
  
Color palettes are used in indexed bitmaps to store colors. Each pixel of the indexed bitmap is an index you should pass to [Item\[Int32\]](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_ColorPalette_Item_1_e1836fc4.htm.md) to get an actual color this pixel represents. These indices should not exceed total number of palette entries which you can get through [Count](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_ColorPalette_Count.htm.md) property.
 
Since the palettes never store more than 256 entries, only few of 16 millions 24-bit RGB colors are available in the palette. That's why if you need change a color of some pixel, you cannot pass arbitrary color. You should find nearest color in the palette and pass its index instead. To convert the color into index in this palette, you can use [FindNearestIndex(RgbColor)](https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_ColorPalette_FindNearestIndex_1_99a0633e.htm.md) method. Note, this method works quite slow, that's why you should cache nearest index if possible.
 
## Inheritance Hierarchy
  
- System.Object
    - Aurigma.GraphicsMill.ColorPalette
 
## Thread Safety
 Static members of this type are not safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.
   
## See Also

### Reference

- [ColorPalette Members](https://www.graphicsmill.com/docs/gm/AllMembers_T_Aurigma_GraphicsMill_ColorPalette.htm.md)
- [Aurigma.GraphicsMill Namespace](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill.htm.md)
- [Bitmap.Palette](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Bitmap_Palette.htm.md)

### Manual

- [Color Depth](https://www.graphicsmill.com/docs/gm/color-depth.htm.md)
