Class ColorBlend
Defines arrays of colors and positions used for interpolating color blending in a multicolor gradient.
Inherited Members
Namespace: Mapsui.Styles.Thematics
Assembly: Mapsui.dll
Syntax
public class ColorBlend
Constructors
| Edit this page View SourceColorBlend(Color[], double[])
Initializes a new instance of the ColorBlend class.
Declaration
public ColorBlend(Color[] colors, double[] positions)
Parameters
Type | Name | Description |
---|---|---|
Color[] | colors | An array of Color structures that represents the colors to use at corresponding positions along a gradient. |
double[] | positions | An array of values that specify percentages of distance along the gradient line. |
Properties
| Edit this page View SourceBlackToWhite
Gets a linear gradient scale from black to white
Declaration
public static ColorBlend BlackToWhite { get; }
Property Value
Type | Description |
---|---|
ColorBlend |
BlueToGreen
Gets a linear gradient scale from blue to green
Declaration
public static ColorBlend BlueToGreen { get; }
Property Value
Type | Description |
---|---|
ColorBlend |
BlueToRed
Gets a linear gradient scale from blue to red
Declaration
public static ColorBlend BlueToRed { get; }
Property Value
Type | Description |
---|---|
ColorBlend |
Colors
Gets or sets an array of colors that represents the colors to use at corresponding positions along a gradient.
Declaration
public Color[]? Colors { get; set; }
Property Value
Type | Description |
---|---|
Color[] |
GreenToBlue
Gets a linear gradient scale from green to blue
Declaration
public static ColorBlend GreenToBlue { get; }
Property Value
Type | Description |
---|---|
ColorBlend |
GreenToRed
Gets a linear gradient scale from green to red
Declaration
public static ColorBlend GreenToRed { get; }
Property Value
Type | Description |
---|---|
ColorBlend |
Positions
Gets or sets the positions along a gradient line.
Declaration
public double[]? Positions { get; set; }
Property Value
Type | Description |
---|---|
double[] | An array of values that specify percentages of distance along the gradient line. |
Remarks
The elements of this array specify percentages of distance along the gradient line. For example, an element value of 0.2f specifies that this point is 20 percent of the total distance from the starting point. The elements in this array are represented by float values between 0.0f and 1.0f, and the first element of the array must be 0.0f and the last element must be 1.0f.
Along with the Colors property, this property defines a multicolor gradient.
Rainbow5
Gets a linear gradient scale with five colors making a rainbow from red to blue.
Declaration
public static ColorBlend Rainbow5 { get; }
Property Value
Type | Description |
---|---|
ColorBlend |
Remarks
Colors span the following with an interval of 0.25: { Color.Red, Color.Yellow, Color.Green, Color.Cyan, Color.Blue }
Rainbow7
Gets a linear gradient scale with seven colors making a rainbow from red to violet.
Declaration
public static ColorBlend Rainbow7 { get; }
Property Value
Type | Description |
---|---|
ColorBlend |
Remarks
Colors span the following with an interval of 1/6: { Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Blue, Color.Indigo, Color.Violet }
RedToBlue
Gets a linear gradient scale from red to blue
Declaration
public static ColorBlend RedToBlue { get; }
Property Value
Type | Description |
---|---|
ColorBlend |
RedToGreen
Gets a linear gradient scale from red to green
Declaration
public static ColorBlend RedToGreen { get; }
Property Value
Type | Description |
---|---|
ColorBlend |
WhiteToBlack
Gets a linear gradient scale from white to black
Declaration
public static ColorBlend WhiteToBlack { get; }
Property Value
Type | Description |
---|---|
ColorBlend |
Methods
| Edit this page View SourceGetColor(double)
Gets the color from the scale at position 'pos'.
Declaration
public Color GetColor(double pos)
Parameters
Type | Name | Description |
---|---|---|
double | pos | Position on scale between 0.0f and 1.0f |
Returns
Type | Description |
---|---|
Color | Color on scale |
Remarks
If the position is outside the scale [0..1] only the fractional part is used (in other words the scale restarts for each integer-part).
ThreeColors(Color, Color, Color)
Creates a linear gradient scale from three colors
Declaration
public static ColorBlend ThreeColors(Color fromColor, Color middleColor, Color toColor)
Parameters
Type | Name | Description |
---|---|---|
Color | fromColor | |
Color | middleColor | |
Color | toColor |
Returns
Type | Description |
---|---|
ColorBlend |
TwoColors(Color, Color)
Creates a linear gradient scale from two colors
Declaration
public static ColorBlend TwoColors(Color fromColor, Color toColor)
Parameters
Type | Name | Description |
---|---|---|
Color | fromColor | |
Color | toColor |
Returns
Type | Description |
---|---|
ColorBlend |