QgsGplColorScheme class

A color scheme which stores its colors in a gpl palette file.

Base classes

class QgsColorScheme
Abstract base class for color schemes.

Derived classes

class QgsUserColorScheme
A color scheme which stores its colors in a gpl palette file within the "palettes" subfolder off the user's QGIS settings folder.

Constructors, destructors, conversion operators

QgsGplColorScheme() defaulted
Constructor for QgsGplColorScheme.

Public functions

auto fetchColors(const QString& context = QString(), const QColor& baseColor = QColor()) -> QgsNamedColorList override
Gets a list of colors from the scheme.
auto setColors(const QgsNamedColorList& colors, const QString& context = QString(), const QColor& baseColor = QColor()) -> bool override
Sets the colors for the scheme.

Protected functions

auto gplFilePath() -> QString pure virtual
Returns the file path for the associated gpl palette file.

Function documentation

QgsNamedColorList QgsGplColorScheme::fetchColors(const QString& context = QString(), const QColor& baseColor = QColor()) override

Gets a list of colors from the scheme.

Parameters
context string specifying an optional context for the returned colors. For instance, a "recent colors" scheme may filter returned colors by context so that colors used only in a "composer" context are returned.
baseColor base color for the scheme's colors. Some color schemes may take advantage of this to filter or modify their returned colors to colors related to the base color.
Returns a list of QPairs of color and color name

The colors can optionally be generated using the supplied context and base color.

bool QgsGplColorScheme::setColors(const QgsNamedColorList& colors, const QString& context = QString(), const QColor& baseColor = QColor()) override

Sets the colors for the scheme.

Parameters
colors list of colors for the scheme
context to set colors for
baseColor base color to set colors for
Returns true if colors were set successfully

This method is only valid for editable color schemes.

QString QgsGplColorScheme::gplFilePath() pure virtual protected

Returns the file path for the associated gpl palette file.

Returns gpl file path