Class: QgsRandomColorRamp

class qgis.core.QgsRandomColorRamp

Bases: QgsColorRamp

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

QgsRandomColorRamp() Constructor for QgsRandomColorRamp.

QgsRandomColorRamp(a0: QgsRandomColorRamp)

Methods

clone

rtype:

Optional[QgsRandomColorRamp]

color

param value:

count

rtype:

int

properties

rtype:

Dict[str, Any]

setTotalColorCount

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

type

rtype:

str

typeString

Returns the string identifier for QgsRandomColorRamp.

value

param index:

clone(self) QgsRandomColorRamp | None
Return type:

Optional[QgsRandomColorRamp]

color(self, value: float) QColor
Parameters:

value (float)

Return type:

QColor

count(self) int
Return type:

int

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

Dict[str, Any]

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

type(self) str
Return type:

str

typeString() str

Returns the string identifier for QgsRandomColorRamp.

Added in version 3.16.

Return type:

str

value(self, index: int) float
Parameters:

index (int)

Return type:

float