Show / Hide Table of Contents

Method Create

Create(PresetColorRampType, uint)

Creates a color ramp with a predefined color ramp type.

Declaration
public static ColorRamp Create(PresetColorRampType type, uint size = 256)
Parameters
Type Name Description
PresetColorRampType type

The predefined color ramp type.

uint size

The number of steps in the complete resulting gradient. A typical value is 256.

Returns
Type Description
ColorRamp

A new color ramp object.

Remarks

For the minimum number of steps, see PresetColorRampType.

Exceptions
Type Condition
ArgumentException

The provided type is None. -OR- The provided number of steps is too small.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8

Create(IEnumerable<Color>, uint)

Creates a custom color ramp with a linear gradient between the provided colors.

Declaration
public static ColorRamp Create(IEnumerable<Color> colors, uint size = 256)
Parameters
Type Name Description
IEnumerable<Color> colors

A list of two or more colors that the color ramp will blend between.

uint size

The number of steps in the complete resulting gradient. A typical value is 256.

Returns
Type Description
ColorRamp

A new color ramp object.

Remarks

The alpha channel of each color is ignored, so every color is treated as if it were completely opaque.

Exceptions
Type Condition
ArgumentException

Fewer than two colors are provided. -OR- The provided number of steps is less than 2 * (number_of_colors - 1).

Applies to

Platforms and versions
TargetVersions
.NET300
.NET Windows300
.NET Android300
.NET iOS300

Create(IEnumerable<ColorStop>, uint)

Creates a custom color ramp with a linear gradient between the provided color stops.

Declaration
public static ColorRamp Create(IEnumerable<ColorStop> colorStops, uint size = 256)
Parameters
Type Name Description
IEnumerable<ColorStop> colorStops

A list of two or more color stops that the color ramp will blend between.

uint size

The number of steps in the complete resulting gradient. A typical value is 256.

Returns
Type Description
ColorRamp

A new color ramp object.

Remarks

Any pixel values placed in a position before the minimum position provided or after the maximum position provided will be shaded with the color of the nearest color stop.

The alpha channel of each color is ignored, so every color is treated as if it were completely opaque.

Exceptions
Type Condition
ArgumentException

Fewer than two color stops are provided. -OR- Any of the color stop positions are not in the interval [0.0, 1.0]. -OR- Fewer than two steps would separate the closest consecutive pair of color stops.

Applies to

Platforms and versions
TargetVersions
.NET300
.NET Windows300
.NET Android300
.NET iOS300
In this article
Provide feedback
Back to top Copyright © 2025 Esri.