Class: QgsLimitedRandomColorRamp¶
Constrained random color ramp, which returns random colors based on preset parameters.
Class Hierarchy¶
Base classes¶
Abstract base class for color ramps. |
Methods
Returns the maximum hue for generated colors |
|
Returns the minimum hue for generated colors |
|
Returns the maximum saturation for generated colors |
|
Returns the minimum saturation for generated colors |
|
Sets the number of colors contained in the ramp. |
|
Sets the maximum hue for generated colors |
|
Sets the minimum hue for generated colors |
|
Sets the maximum saturation for generated colors |
|
Sets the minimum saturation for generated colors |
|
Sets the maximum value for generated colors |
|
Sets the minimum value for generated colors |
|
Must be called after changing the properties of the color ramp to regenerate the list of random colors. |
|
Returns the maximum value for generated colors |
|
Returns the minimum value for generated colors |
Static Methods
Returns a new |
|
Gets a list of random colors |
|
Returns the string identifier for QgsLimitedRandomColorRamp. |
- class qgis.core.QgsLimitedRandomColorRamp[source]¶
Bases:
QgsColorRamp
- __init__(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)
Constructor for QgsLimitedRandomColorRamp
- Parameters:
count (int = DEFAULT_RANDOM_COUNT) – number of colors in ramp
hueMin (int = DEFAULT_RANDOM_HUE_MIN) – minimum hue
hueMax (int = DEFAULT_RANDOM_HUE_MAX) – maximum hue
satMin (int = DEFAULT_RANDOM_SAT_MIN) – minimum saturation
satMax (int = DEFAULT_RANDOM_SAT_MAX) – maximum saturation
valMin (int = DEFAULT_RANDOM_VAL_MIN) – minimum color value
valMax (int = DEFAULT_RANDOM_VAL_MAX) – maximum color value
- __init__(a0: QgsLimitedRandomColorRamp)
- Parameters:
- static create(properties: Dict[str, Any] = {}) QgsColorRamp | None [source]¶
Returns a new
QgsLimitedRandomColorRamp
color ramp created using the properties encoded in a string map.- Parameters:
properties (Dict[str, Any] = {}) – color ramp properties
See also
properties()
- Return type:
Optional[QgsColorRamp]
- static 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
- Parameters:
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)
- Return type:
List[QColor]
- satMax(self) int [source]¶
Returns the maximum saturation for generated colors
See also
- Return type:
int
- satMin(self) int [source]¶
Returns the minimum saturation for generated colors
See also
- Return type:
int
- setCount(self, val: int)[source]¶
Sets the number of colors contained in the ramp.
- Parameters:
val (int)
- setHueMax(self, val: int)[source]¶
Sets the maximum hue for generated colors
See also
- Parameters:
val (int)
- setHueMin(self, val: int)[source]¶
Sets the minimum hue for generated colors
See also
- Parameters:
val (int)
- setSatMax(self, val: int)[source]¶
Sets the maximum saturation for generated colors
See also
- Parameters:
val (int)
- setSatMin(self, val: int)[source]¶
Sets the minimum saturation for generated colors
See also
- Parameters:
val (int)
- setValMax(self, val: int)[source]¶
Sets the maximum value for generated colors
See also
- Parameters:
val (int)
- setValMin(self, val: int)[source]¶
Sets the minimum value for generated colors
See also
- Parameters:
val (int)
- static typeString() str [source]¶
Returns the string identifier for QgsLimitedRandomColorRamp.
Added in version 3.16.
- Return type:
str
- updateColors(self)[source]¶
Must be called after changing the properties of the color ramp to regenerate the list of random colors.