colorRamp function

Syntax

  • string colorRamp(gradient, value)

Parameters

  1. gradientstring
    { whiteToBlack | greenToRed |yellowToRed | redToBlue | orangeToBlue | brownToBlue | spectrum }—selector for different color ramp presets.
  2. valuefloat ( range[0,1])

Returns

Hex color value from a color ramp (selected with gradient) according to the given value. Means the value is mapped on the color ramp and the corresponding color is returned.

Description

The colorRamp function returns the hex color value from a color ramp (selected with gradient) according to the given value.

Examples

Yellow to red color ramp

@Range(min=0, max=1)
attr colorValue = 1

@StartRule
Shape -->
    color ( colorRamp("yellowToRed",colorValue))
Yellow to red color ramp

Ramp example images based on a GIS dataset

Yellow to red:

Yellow to red

Red to blue:

Red to blue

Green to red:

Green to red

White to black:

White to black

Orange to blue:

Orange to blue

Brown to blue:

Brown to blue

Spectrum:

Spectrum

In this topic