QgsRecentColorScheme class

A color scheme which contains the most recently used colors.

Base classes

class QgsColorScheme
Abstract base class for color schemes.

Public static functions

static void addRecentColor(const QColor& color)
Adds a color to the list of recent colors.
static auto lastUsedColor() -> QColor
Returns the most recently used color.

Constructors, destructors, conversion operators

QgsRecentColorScheme() defaulted
Constructor for QgsRecentColorScheme.

Public functions

auto clone() const -> QgsRecentColorScheme* override
Clones a color scheme.
auto fetchColors(const QString& context = QString(), const QColor& baseColor = QColor()) -> QgsNamedColorList override
Gets a list of colors from the scheme.
auto flags() const -> SchemeFlags override
Returns the current flags for the color scheme.
auto schemeName() const -> QString override
Gets the name for the color scheme.

Function documentation

static void QgsRecentColorScheme::addRecentColor(const QColor& color)

Adds a color to the list of recent colors.

Parameters
color color to add

static QColor QgsRecentColorScheme::lastUsedColor()

Returns the most recently used color.

QgsRecentColorScheme* QgsRecentColorScheme::clone() const override

Clones a color scheme.

Returns copy of color scheme

QgsNamedColorList QgsRecentColorScheme::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.

SchemeFlags QgsRecentColorScheme::flags() const override

Returns the current flags for the color scheme.

Returns current flags

QString QgsRecentColorScheme::schemeName() const override

Gets the name for the color scheme.

Returns color scheme name