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:
QgsColorRamp
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
QgsLimitedRandomColorRamp(
QgsLimitedRandomColorRamp
)Constrained random color ramp, which returns random colors based on preset parameters.
Methods
- rtype
QgsLimitedRandomColorRamp
- param value
- rtype
int
Returns a new
QgsLimitedRandomColorRamp
color ramp created using the properties encoded in a string map.Returns the maximum hue for generated colors
Returns the minimum hue for generated colors
- rtype
Dict[str, str]
Gets a list of random 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
- rtype
str
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
- param index
-
clone
(self) → QgsLimitedRandomColorRamp¶ - Return type
-
color
(self, value: float) → QColor¶ - Parameters
value (float) –
- Return type
QColor
-
count
(self) → int¶ - Return type
int
-
create
(properties: Dict[str, str] = {}) → QgsColorRamp¶ Returns a new
QgsLimitedRandomColorRamp
color ramp created using the properties encoded in a string map.- Parameters
properties (Dict[str) – color ramp properties
See also
- Return type
-
hueMax
(self) → int¶ Returns the maximum hue for generated colors
See also
- Return type
int
-
hueMin
(self) → int¶ Returns the minimum hue for generated colors
See also
- Return type
int
-
properties
(self) → Dict[str, str]¶ - Return type
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.
- 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¶ Returns the maximum saturation for generated colors
See also
- Return type
int
-
satMin
(self) → int¶ Returns the minimum saturation for generated colors
See also
- Return type
int
-
setCount
(self, val: int)¶ Sets the number of colors contained in the ramp.
- Parameters
val (int) –
-
setHueMax
(self, val: int)¶ Sets the maximum hue for generated colors
See also
- Parameters
val (int) –
-
setHueMin
(self, val: int)¶ Sets the minimum hue for generated colors
See also
- Parameters
val (int) –
-
setSatMax
(self, val: int)¶ Sets the maximum saturation for generated colors
See also
- Parameters
val (int) –
-
setSatMin
(self, val: int)¶ Sets the minimum saturation for generated colors
See also
- Parameters
val (int) –
-
setValMax
(self, val: int)¶ Sets the maximum value for generated colors
See also
- Parameters
val (int) –
-
setValMin
(self, val: int)¶ Sets the minimum value for generated colors
See also
- Parameters
val (int) –
-
type
(self) → str¶ - Return type
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
- Return type
int
-
valMin
(self) → int¶ Returns the minimum value for generated colors
See also
- Return type
int
-
value
(self, index: int) → float¶ - Parameters
index (int) –
- Return type
float