Class: QgsColorBrewerColorRamp

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

Bases: QgsColorRamp

Constructor for QgsColorBrewerColorRamp

Parameters
  • schemeName (str = '') – color brewer scheme name

  • colors (int = DEFAULT_COLORBREWER_COLORS) – number of colors in ramp

  • inverted (bool = False) – invert ramp ordering

QgsColorBrewerColorRamp(QgsColorBrewerColorRamp)

Color ramp utilising “Color Brewer” preset color schemes.

Methods

clone

rtype

QgsColorBrewerColorRamp

color

param value

colors

Returns the number of colors in the ramp.

count

rtype

int

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

rtype

Dict[str, str]

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

rtype

str

typeString

Returns the string identifier for QgsColorBrewerColorRamp.

value

param index

clone(self)QgsColorBrewerColorRamp
Return type

QgsColorBrewerColorRamp

color(self, value: float) → QColor
Parameters

value (float) –

Return type

QColor

colors(self) → int

Returns the number of colors in the ramp.

See also

setColors()

Return type

int

count(self) → int
Return type

int

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

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

Parameters

properties (Dict[str) – color ramp properties

See also

properties()

Return type

QgsColorRamp

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

Returns a list of all valid color brewer scheme names.

Return type

List[str]

listSchemeVariants(schemeName: str) → List[int]

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

Parameters

schemeName (str) – color brewer scheme name

Return type

List[int]

loadPalette(self)

Generates the scheme using the current name and number of colors

properties(self) → Dict[str, str]
Return type

Dict[str, str]

schemeName(self) → str

Returns the name of the color brewer color scheme.

See also

setSchemeName()

Return type

str

setColors(self, colors: int)

Sets the number of colors in the ramp.

Parameters

colors (int) – 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 (str) – scheme name, must match a valid color brewer scheme name

See also

schemeName()

type(self) → str
Return type

str

typeString() → str

Returns the string identifier for QgsColorBrewerColorRamp.

New in version 3.16.

Return type

str

value(self, index: int) → float
Parameters

index (int) –

Return type

float