Class: QgsGradientStop

Represents a color stop within a QgsGradientColorRamp color ramp.

Methods

colorSpec

Returns the color specification in which the color component interpolation will occur.

direction

Returns the direction to traverse the color wheel using when interpolating hue-based color specifications.

setColorSpec

Sets the color specification in which the color component interpolation will occur.

setDirection

Sets the direction to traverse the color wheel using when interpolating hue-based color specifications.

Attributes

color

Gradient color at stop

offset

Relative positional offset, between 0 and 1

class qgis.core.QgsGradientStop[source]

Bases: object

__init__(offset: float, color: QColor | Qt.GlobalColor)

Constructor for QgsGradientStop

Parameters:
  • offset (float) – positional offset for stop, between 0 and 1.0

  • color (Union[QColor, Qt.GlobalColor]) – color for stop

__init__(a0: QgsGradientStop)
Parameters:

a0 (QgsGradientStop)

color: QColor

Gradient color at stop

colorSpec(self) QColor.Spec[source]

Returns the color specification in which the color component interpolation will occur.

For multi-stop gradients this color spec will be used for the portion of the color ramp leading into the current stop.

See also

setColorSpec()

Added in version 3.24.

Return type:

QColor.Spec

direction(self) Qgis.AngularDirection[source]

Returns the direction to traverse the color wheel using when interpolating hue-based color specifications.

For multi-stop gradients this direction will be used for the portion of the color ramp leading into the current stop.

See also

setDirection()

Added in version 3.24.

Return type:

Qgis.AngularDirection

offset: float

Relative positional offset, between 0 and 1

setColorSpec(self, spec: QColor.Spec)[source]

Sets the color specification in which the color component interpolation will occur.

Only QColor.Spec.Rgb, QColor.Spec.Hsv and QColor.Spec.Hsl are currently supported.

For multi-stop gradients this color spec will be used for the portion of the color ramp leading into the current stop.

See also

colorSpec()

Added in version 3.24.

Parameters:

spec (QColor.Spec)

setDirection(self, direction: Qgis.AngularDirection)[source]

Sets the direction to traverse the color wheel using when interpolating hue-based color specifications.

For multi-stop gradients this direction will be used for the portion of the color ramp leading into the current stop.

See also

direction()

Added in version 3.24.

Parameters:

direction (Qgis.AngularDirection)