QgsColorRamp class

Abstract base class for color ramps.

Contents

Derived classes

class QgsColorBrewerColorRamp
Color ramp utilising "Color Brewer" preset color schemes.
class QgsGradientColorRamp
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra color stops.
class QgsLimitedRandomColorRamp
Constrained random color ramp, which returns random colors based on preset parameters.
class QgsPresetSchemeColorRamp
A scheme based color ramp consisting of a list of predefined colors.
class QgsRandomColorRamp
Totally random color ramp.

Public functions

auto clone() const -> QgsColorRamp* pure virtual
Creates a clone of the color ramp.
auto color(double value) const -> QColor pure virtual
Returns the color corresponding to a specified value.
auto count() const -> int pure virtual
Returns number of defined colors, or -1 if undefined.
void invert() virtual
Inverts the ordering of the color ramp.
auto properties() const -> QgsStringMap pure virtual
Returns a string map containing all the color ramp's properties.
auto type() const -> QString pure virtual
Returns a string representing the color ramp type.
auto value(int index) const -> double pure virtual
Returns relative value between [0,1] of color at specified index.

Function documentation

QColor QgsColorRamp::color(double value) const pure virtual

Returns the color corresponding to a specified value.

Parameters
value value between [0, 1] inclusive
Returns color for value