Class: QgsPresetSchemeColorRamp

A scheme based color ramp consisting of a list of predefined colors.

Class Hierarchy

Inheritance diagram of qgis.core.QgsPresetSchemeColorRamp

Base classes

QgsColorRamp

Abstract base class for color ramps.

QgsColorScheme

Abstract base class for color schemes.

Methods

colors

Returns the list of colors used by the ramp.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsPresetSchemeColorRamp. See the FAQ for more details.

setColors

Sets the list of colors used by the ramp.

Static Methods

create

Returns a new QgsPresetSchemeColorRamp color ramp created using the properties encoded in a string map.

typeString

Returns the string identifier for QgsPresetSchemeColorRamp.

class qgis.core.QgsPresetSchemeColorRamp[source]

Bases: QgsColorRamp, QgsColorScheme

__init__(colors: Iterable[QColor | Qt.GlobalColor] = [])

Constructor for QgsPresetSchemeColorRamp.

Parameters:

colors (Iterable[Union[QColor, Qt.GlobalColor]] = []) – list of colors in ramp

__init__(colors: Iterable[Tuple[QColor | Qt.GlobalColor, str | None]])

Constructor for QgsPresetColorRamp.

Parameters:

colors (Iterable[Tuple[Union[QColor, Qt.GlobalColor], Optional[str]]]) – list of named colors in ramp

__init__(a0: QgsPresetSchemeColorRamp)
Parameters:

a0 (QgsPresetSchemeColorRamp)

colors(self) List[QColor]

Returns the list of colors used by the ramp.

See also

setColors()

Return type:

List[QColor]

static create(properties: Dict[str, Any] = {}) QgsColorRamp | None[source]

Returns a new QgsPresetSchemeColorRamp color ramp created using the properties encoded in a string map.

Parameters:

properties (Dict[str, Any] = {}) – color ramp properties

See also

properties()

Return type:

Optional[QgsColorRamp]

virtual setColors(self, colors: Iterable[Tuple[QColor | Qt.GlobalColor, str | None]], a1: str | None = '', a2: QColor | Qt.GlobalColor = QColor()) bool[source]

Sets the list of colors used by the ramp.

Parameters:

colors (Iterable[Tuple[Union[QColor, Qt.GlobalColor], Optional[str]]]) – list of colors

See also

colors()

Parameters:
  • a1 (Optional[str] = '')

  • a2 (Union[QColor, Qt.GlobalColor] = QColor())

Return type:

bool

static typeString() str[source]

Returns the string identifier for QgsPresetSchemeColorRamp.

Added in version 3.16.

Return type:

str