Class: QgsPresetSchemeColorRamp

class qgis.core.QgsPresetSchemeColorRamp

Bases: QgsColorRamp, QgsColorScheme

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

New in version 3.0.

QgsPresetSchemeColorRamp(colors: Iterable[Union[QColor, Qt.GlobalColor, QGradient]] = []) Constructor for QgsPresetSchemeColorRamp.

Parameters:

colors – list of colors in ramp

QgsPresetSchemeColorRamp(colors: Iterable[Tuple[Union[QColor, Qt.GlobalColor, QGradient], str]]) Constructor for QgsPresetColorRamp.

Parameters:

colors – list of named colors in ramp

QgsPresetSchemeColorRamp(QgsPresetSchemeColorRamp)

Methods

clone

rtype:

QgsPresetSchemeColorRamp

color

param value:

colors

Returns the list of colors used by the ramp.

count

rtype:

int

create

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

fetchColors

param context:

invert

isEditable

rtype:

bool

properties

rtype:

Dict[str, Any]

schemeName

rtype:

str

setColors

Sets the list of colors used by the ramp.

type

rtype:

str

typeString

Returns the string identifier for QgsPresetSchemeColorRamp.

value

param index:

clone(self) QgsPresetSchemeColorRamp
Return type:

QgsPresetSchemeColorRamp

color(self, value: float) QColor
Parameters:

value (float) –

Return type:

QColor

colors(self) List[QColor]

Returns the list of colors used by the ramp.

See also

setColors()

Return type:

List[QColor]

count(self) int
Return type:

int

create(properties: Dict[str, Any] = {}) QgsColorRamp

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

Parameters:

properties (Dict[str) – color ramp properties

See also

properties()

Return type:

QgsColorRamp

fetchColors(self, context: str = '', baseColor: QColor | Qt.GlobalColor | QGradient = QColor()) List[Tuple[QColor, str]]
Parameters:
  • context (str = '') –

  • baseColor (Union[QColor) –

Return type:

List[Tuple[QColor, str]]

invert(self)
isEditable(self) bool
Return type:

bool

properties(self) Dict[str, Any]
Return type:

Dict[str, Any]

schemeName(self) str
Return type:

str

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

Sets the list of colors used by the ramp.

Parameters:

colors (Iterable[Tuple[Union[QColor) – list of colors

See also

colors()

Parameters:
  • a1 (str = '') –

  • a2 (Union[QColor) –

Return type:

bool

type(self) str
Return type:

str

typeString() str

Returns the string identifier for QgsPresetSchemeColorRamp.

New in version 3.16.

Return type:

str

value(self, index: int) float
Parameters:

index (int) –

Return type:

float