Class: QgsColorBrewerColorRamp

class qgis.core.QgsColorBrewerColorRamp(schemeName: str = '', colors: int = DEFAULT_COLORBREWER_COLORS, inverted: bool = False)

Bases: qgis._core.QgsColorRamp

Constructor for QgsColorBrewerColorRamp

Parameters
  • schemeName – color brewer scheme name

  • colors – number of colors in ramp

  • inverted – invert ramp ordering

QgsColorBrewerColorRamp(QgsColorBrewerColorRamp)

Color ramp utilising “Color Brewer” preset color schemes.

New in version 3.0: Enums

Methods

clone

color

colors

Returns the number of colors in the ramp.

count

create

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

invert

listSchemeNames

Returns a list of all valid color brewer scheme names.

listSchemeVariants

Returns a list of the valid variants (numbers of colors) for a specified color brewer scheme name

loadPalette

Generates the scheme using the current name and number of colors

properties

schemeName

Returns the name of the color brewer color scheme.

setColors

Sets the number of colors in the ramp.

setSchemeName

Sets the name of the color brewer color scheme.

type

value

Signals

Attributes

clone(self) → QgsColorBrewerColorRamp
color(self, value: float) → QColor
colors(self) → int

Returns the number of colors in the ramp.

See also

setColors()

count(self) → int
create(properties: Dict[str, str] = {}) → QgsColorRamp

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

Parameters

properties – color ramp properties

See also

properties()

invert(self)
listSchemeNames() → List[str]

Returns a list of all valid color brewer scheme names.

listSchemeVariants(schemeName: str) → List[int]

Returns a list of the valid variants (numbers of colors) for a specified color brewer scheme name

Parameters

schemeName – color brewer scheme name

loadPalette(self)

Generates the scheme using the current name and number of colors

properties(self) → Dict[str, str]
schemeName(self) → str

Returns the name of the color brewer color scheme.

See also

setSchemeName()

setColors(self, colors: int)

Sets the number of colors in the ramp.

Parameters

colors – number of colors. Must match a valid value for the scheme, which can be retrieved using listSchemeVariants()

See also

colors()

setSchemeName(self, schemeName: str)

Sets the name of the color brewer color scheme.

Parameters

schemeName – scheme name, must match a valid color brewer scheme name

See also

schemeName()

type(self) → str
value(self, index: int) → float