Class: QgsRandomColorRamp

A color ramp consisting of random colors, constrained within component ranges.

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

Class Hierarchy

Inheritance diagram of qgis.core.QgsRandomColorRamp

Base classes

QgsColorRamp

Abstract base class for color ramps.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsRandomColorRamp. See the FAQ for more details.

setTotalColorCount

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

Static Methods

typeString

Returns the string identifier for QgsRandomColorRamp.

class qgis.core.QgsRandomColorRamp[source]

Bases: QgsColorRamp

virtual setTotalColorCount(self, colorCount: int)[source]

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

static typeString() str[source]

Returns the string identifier for QgsRandomColorRamp.

Added in version 3.16.

Return type:

str