Subgroup: Color

Class: QgsColorRamp

class qgis.core.QgsColorRamp

Bases: sip.wrapper

Abstract base class for color ramps

New in version 3.0: Methods

clone Creates a clone of the color ramp.
color Returns the color corresponding to a specified value.
count Returns number of defined colors, or -1 if undefined
invert Inverts the ordering of the color ramp.
properties Returns a string map containing all the color ramp’s properties.
type Returns a string representing the color ramp type.
value Returns relative value between [0,1] of color at specified index

Signals

Attributes

clone(self) → QgsColorRamp

Creates a clone of the color ramp.

color(self, value: float) → QColor

Returns the color corresponding to a specified value.

Parameters:value – value between [0, 1] inclusive
Returns:color for value
count(self) → int

Returns number of defined colors, or -1 if undefined

invert(self)

Inverts the ordering of the color ramp.

properties(self) → Dict[str, str]

Returns a string map containing all the color ramp’s properties.

type(self) → str

Returns a string representing the color ramp type.

value(self, index: int) → float

Returns relative value between [0,1] of color at specified index