PaletteGetNearestColor Method

Gets a Color32 entry of this Palette that is the nearest color to the specified Color32 instance.

Definition

Namespace: KGySoft.Drawing.Imaging
Assembly: KGySoft.Drawing.Core (in KGySoft.Drawing.Core.dll) Version: 8.1.0
C#
public Color32 GetNearestColor(
	Color32 c
)

Parameters

c  Color32
The color for which the nearest palette entry should be returned.

Return Value

Color32
The Color32 entry of this Palette that is the nearest color to the specified Color32 instance.

Remarks

If the Palette does not contain the specified color, then the result may depend on the arguments passed to the constructor.

If c has transparency, then the result may depend on BackColor and AlphaThreshold values.

The result can be customized by passing a non- delegate to one of the Palette constructors.

  Note

For more details see the Remarks section of the Palette class.

Exceptions

IndexOutOfRangeExceptionThe Palette class was initialized by a custom lookup delegate, which returned an invalid index.

See Also