Class: QgsColorSchemeRegistry¶
-
class
qgis.core.
QgsColorSchemeRegistry
¶ Bases:
sip.wrapper
Constructor for an empty color scheme registry
QgsColorSchemeRegistry(
QgsColorSchemeRegistry
)Registry of color schemes
A registry of
QgsColorScheme
color schemes. This class can be created directly, or accessed via aQgsApplication.colorSchemeRegistry()
.Methods
Adds a color scheme to the registry.
Adds all default color schemes to this color scheme.
Creates schemes for all gpl palettes in the user’s palettes folder.
Returns a random color for use with a new symbol style (e.g.
Initializes the default random style color scheme for the user.
Adds all color schemes from the global instance to this color scheme.
Returns the color scheme used when fetching random colors to use for symbol styles.
Removes all matching color schemes from the registry
Returns all color schemes in the registry
Sets the color
scheme
to use when fetching random colors to use for symbol styles.-
addColorScheme
(self, scheme: QgsColorScheme)¶ Adds a color scheme to the registry. Ownership of the scheme is transferred to the registry.
- Parameters
scheme (QgsColorScheme) – color scheme to add
See also
See also
-
addDefaultSchemes
(self)¶ Adds all default color schemes to this color scheme.
See also
See also
See also
-
addUserSchemes
(self)¶ Creates schemes for all gpl palettes in the user’s palettes folder.
See also
See also
See also
-
fetchRandomStyleColor
(self) → QColor¶ Returns a random color for use with a new symbol style (e.g. for a newly created map layer).
If a
randomStyleColorScheme()
is set then this color will be randomly taken from that color scheme. If norandomStyleColorScheme()
is set then a totally random color will be generated.Note that calling
setRandomStyleColorScheme()
takes a snapshot of the colors from the scheme’sQgsColorScheme.fetchColors()
list. Accordingly, any future changes to the colors in the scheme are not automatically reflected by calls tofetchRandomStyleColor()
. If the scheme is updated, then another call tosetRandomStyleColorScheme()
must be made in order to update the cached list of available style colors from whichfetchRandomStyleColor()
selects colors.This method is thread safe.
See also
See also
New in version 3.2.
- Return type
QColor
-
initStyleScheme
(self)¶ Initializes the default random style color scheme for the user.
New in version 3.2.
-
populateFromInstance
(self)¶ Adds all color schemes from the global instance to this color scheme.
See also
See also
-
randomStyleColorScheme
(self) → QgsColorScheme¶ Returns the color scheme used when fetching random colors to use for symbol styles.
This may be
None
, in which case totally random colors are used for styles.See also
See also
New in version 3.2.
- Return type
-
removeColorScheme
(self, scheme: QgsColorScheme) → bool¶ Removes all matching color schemes from the registry
- Parameters
scheme (QgsColorScheme) – color scheme to remove
- Return type
bool
- Returns
True
if scheme was found and removed
See also
-
schemes
(self) → List[QgsColorScheme]¶ Returns all color schemes in the registry
- Returns
list of color schemes
schemes(self, flag: QgsColorScheme.SchemeFlag) -> List[QgsColorScheme] Returns all color schemes in the registry which have a specified flag set
- Parameters
flag – flag to match
- Return type
List[QgsColorScheme]
- Returns
list of color schemes with flag set
-
setRandomStyleColorScheme
(self, scheme: QgsColorScheme)¶ Sets the color
scheme
to use when fetching random colors to use for symbol styles.scheme
should match a color scheme which is already present in the registry.Note that calling this method takes a snapshot of the colors from the scheme’s
QgsColorScheme.fetchColors()
list. Accordingly, any future changes to the colors inscheme
are not automatically reflected by calls tofetchRandomStyleColor()
. Ifscheme
is updated, then another call tosetRandomStyleColorScheme()
must be made in order to update the cached list of available style colors.See also
See also
New in version 3.2.
- Parameters
scheme (QgsColorScheme) –
-