Class: QgsLimitedRandomColorRamp

class qgis.core.QgsLimitedRandomColorRamp(count: int = DEFAULT_RANDOM_COUNT, hueMin: int = DEFAULT_RANDOM_HUE_MIN, hueMax: int = DEFAULT_RANDOM_HUE_MAX, satMin: int = DEFAULT_RANDOM_SAT_MIN, satMax: int = DEFAULT_RANDOM_SAT_MAX, valMin: int = DEFAULT_RANDOM_VAL_MIN, valMax: int = DEFAULT_RANDOM_VAL_MAX)

Bases: qgis._core.QgsColorRamp

Constructor for QgsLimitedRandomColorRamp

Parameters:
  • count – number of colors in ramp
  • hueMin – minimum hue
  • hueMax – maximum hue
  • satMin – minimum saturation
  • satMax – maximum saturation
  • valMin – minimum color value
  • valMax – maximum color value

QgsLimitedRandomColorRamp(QgsLimitedRandomColorRamp)

Constrained random color ramp, which returns random colors based on preset parameters.

New in version 3.0: Enums

Methods

clone
color
count
create Returns a new QgsLimitedRandomColorRamp color ramp created using the properties encoded in a string map.
hueMax Returns the maximum hue for generated colors
hueMin Returns the minimum hue for generated colors
properties
randomColors Gets a list of random colors
satMax Returns the maximum saturation for generated colors
satMin Returns the minimum saturation for generated colors
setCount Sets the number of colors contained in the ramp.
setHueMax Sets the maximum hue for generated colors
setHueMin Sets the minimum hue for generated colors
setSatMax Sets the maximum saturation for generated colors
setSatMin Sets the minimum saturation for generated colors
setValMax Sets the maximum value for generated colors
setValMin Sets the minimum value for generated colors
type
updateColors Must be called after changing the properties of the color ramp to regenerate the list of random colors.
valMax Returns the maximum value for generated colors
valMin Returns the minimum value for generated colors
value

Signals

Attributes

clone(self) → QgsLimitedRandomColorRamp
color(self, value: float) → QColor
count(self) → int
create(properties: Dict[str, str] = {}) → QgsColorRamp

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

Parameters:properties – color ramp properties

See also

properties()

hueMax(self) → int

Returns the maximum hue for generated colors

See also

setHueMax()

hueMin(self) → int

Returns the minimum hue for generated colors

See also

setHueMin()

properties(self) → Dict[str, str]
randomColors(count: int, hueMax: int = DEFAULT_RANDOM_HUE_MAX, hueMin: int = DEFAULT_RANDOM_HUE_MIN, satMax: int = DEFAULT_RANDOM_SAT_MAX, satMin: int = DEFAULT_RANDOM_SAT_MIN, valMax: int = DEFAULT_RANDOM_VAL_MAX, valMin: int = DEFAULT_RANDOM_VAL_MIN) → List[QColor]

Gets a list of random colors

New in version 2.4.

satMax(self) → int

Returns the maximum saturation for generated colors

See also

setSatMax()

satMin(self) → int

Returns the minimum saturation for generated colors

See also

setSatMin()

setCount(self, val: int)

Sets the number of colors contained in the ramp.

setHueMax(self, val: int)

Sets the maximum hue for generated colors

See also

hueMax()

setHueMin(self, val: int)

Sets the minimum hue for generated colors

See also

hueMin()

setSatMax(self, val: int)

Sets the maximum saturation for generated colors

See also

satMax()

setSatMin(self, val: int)

Sets the minimum saturation for generated colors

See also

satMin()

setValMax(self, val: int)

Sets the maximum value for generated colors

See also

valMax()

setValMin(self, val: int)

Sets the minimum value for generated colors

See also

valMin()

type(self) → str
updateColors(self)

Must be called after changing the properties of the color ramp to regenerate the list of random colors.

valMax(self) → int

Returns the maximum value for generated colors

See also

setValMax()

valMin(self) → int

Returns the minimum value for generated colors

See also

setValMin()

value(self, index: int) → float