Class: QgsRandomColorRamp

class qgis.core.QgsRandomColorRamp

Bases: QgsColorRamp

Constructor for QgsRandomColorRamp.

QgsRandomColorRamp(QgsRandomColorRamp)

Totally random color ramp. Returns colors generated at random, but constrained to some hardcoded saturation and value ranges to prevent ugly color generation.

Methods

clone

rtype

QgsRandomColorRamp

color

param value

count

rtype

int

properties

rtype

Dict[str, str]

setTotalColorCount

Sets the desired total number of unique colors for the resultant ramp.

type

rtype

str

value

param index

clone(self)QgsRandomColorRamp
Return type

QgsRandomColorRamp

color(self, value: float) → QColor
Parameters

value (float) –

Return type

QColor

count(self) → int
Return type

int

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

Dict[str, str]

setTotalColorCount(self, colorCount: int)

Sets the desired total number of unique colors for the resultant ramp. Calling this method pregenerates a set of visually distinct colors which are returned by subsequent calls to color().

Parameters

colorCount (int) – number of unique colors

New in version 2.5.

type(self) → str
Return type

str

value(self, index: int) → float
Parameters

index (int) –

Return type

float