Kirigami::Platform::PlatformTheme Class

class Kirigami::Platform::PlatformTheme
Header: #include <Kirigami/Platform/PlatformTheme>
CMake: find_package(KF6 REQUIRED COMPONENTS KirigamiPlatform)
target_link_libraries(mytarget PRIVATE KF6::KirigamiPlatform)
In QML: Theme
Inherits: QObject

Public Types

enum ColorGroup { Disabled, Active, Inactive, Normal }
enum ColorSet { View, Window, Button, Selection, Tooltip, …, Header }

Properties

Public Functions

QColor activeBackgroundColor() const
QColor activeTextColor() const
QColor alternateBackgroundColor() const
QColor backgroundColor() const
Kirigami::Platform::PlatformTheme::ColorGroup colorGroup() const
Kirigami::Platform::PlatformTheme::ColorSet colorSet() const
QFont defaultFont() const
QColor disabledTextColor() const
QColor focusColor() const
qreal frameContrast() const
QColor highlightColor() const
QColor highlightedTextColor() const
QColor hoverColor() const
virtual QIcon iconFromTheme(const QString &name, const QColor &customColor = Qt::transparent)
bool inherit() const
qreal lightFrameContrast() const
QColor linkBackgroundColor() const
QColor linkColor() const
QColor negativeBackgroundColor() const
QColor negativeTextColor() const
QColor neutralBackgroundColor() const
QColor neutralTextColor() const
QPalette palette() const
QColor positiveBackgroundColor() const
QColor positiveTextColor() const
void setColorGroup(Kirigami::Platform::PlatformTheme::ColorGroup)
void setColorSet(Kirigami::Platform::PlatformTheme::ColorSet)
void setCustomActiveBackgroundColor(const QColor &color = QColor())
void setCustomActiveTextColor(const QColor &color = QColor())
void setCustomAlternateBackgroundColor(const QColor &color = QColor())
void setCustomBackgroundColor(const QColor &color = QColor())
void setCustomDisabledTextColor(const QColor &color = QColor())
void setCustomFocusColor(const QColor &color = QColor())
void setCustomHighlightColor(const QColor &color = QColor())
void setCustomHighlightedTextColor(const QColor &color = QColor())
void setCustomHoverColor(const QColor &color = QColor())
void setCustomLinkBackgroundColor(const QColor &color = QColor())
void setCustomLinkColor(const QColor &color = QColor())
void setCustomNegativeBackgroundColor(const QColor &color = QColor())
void setCustomNegativeTextColor(const QColor &color = QColor())
void setCustomNeutralBackgroundColor(const QColor &color = QColor())
void setCustomNeutralTextColor(const QColor &color = QColor())
void setCustomPositiveBackgroundColor(const QColor &color = QColor())
void setCustomPositiveTextColor(const QColor &color = QColor())
void setCustomTextColor(const QColor &color = QColor())
void setCustomVisitedLinkBackgroundColor(const QColor &color = QColor())
void setCustomVisitedLinkColor(const QColor &color = QColor())
void setInherit(bool inherit)
void setUseAlternateBackgroundColor(bool alternate)
QFont smallFont() const
QColor textColor() const
bool useAlternateBackgroundColor() const
QColor visitedLinkBackgroundColor() const
QColor visitedLinkColor() const

Signals

void colorGroupChanged(Kirigami::Platform::PlatformTheme::ColorGroup colorGroup)
void colorSetChanged(Kirigami::Platform::PlatformTheme::ColorSet colorSet)
void colorsChanged()
void defaultFontChanged(const QFont &font)
void inheritChanged(bool inherit)
void paletteChanged(const QPalette &pal)
void smallFontChanged(const QFont &font)
void useAlternateBackgroundColorChanged(bool alternate)

Detailed Description

This class is the base for color management in Kirigami, different platforms can reimplement this class to integrate with system platform colors of a given platform

Member Type Documentation

enum PlatformTheme::ColorGroup

ConstantValue
Kirigami::Platform::PlatformTheme::DisabledQPalette::Disabled
Kirigami::Platform::PlatformTheme::ActiveQPalette::Active
Kirigami::Platform::PlatformTheme::InactiveQPalette::Inactive
Kirigami::Platform::PlatformTheme::NormalQPalette::Normal

enum PlatformTheme::ColorSet

ConstantValueDescription
Kirigami::Platform::PlatformTheme::View0Color set for item views, usually the lightest of all
Kirigami::Platform::PlatformTheme::Window1Default Color set for windows and "chrome" areas
Kirigami::Platform::PlatformTheme::Button2Color set used by buttons
Kirigami::Platform::PlatformTheme::Selection3Color set used by selected areas
Kirigami::Platform::PlatformTheme::Tooltip4Color set used by tooltips
Kirigami::Platform::PlatformTheme::Complementary5Color set meant to be complementary to Window: usually is a dark theme for light themes
Kirigami::Platform::PlatformTheme::Header6Color set to be used by heading areas of applications, such as toolbars

Property Documentation

activeBackgroundColor : QColor

Background for areas that are active or requesting attention

Access functions:

QColor activeBackgroundColor() const
void setCustomActiveBackgroundColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

activeTextColor : QColor

Foreground for areas that are active or requesting attention

Access functions:

QColor activeTextColor() const
void setCustomActiveTextColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

alternateBackgroundColor : QColor

The generic background color Alternate background; for example, for use in lists. This color may be the same as BackgroundNormal, especially in sets other than View and Window.

Access functions:

QColor alternateBackgroundColor() const
void setCustomAlternateBackgroundColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

backgroundColor : QColor

The generic background color

Access functions:

QColor backgroundColor() const
void setCustomBackgroundColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

[since 4.43] colorGroup : ColorGroup

This enumeration describes the color group used to generate the colors. The enum value is based upon QPalette::ColorGroup and has the same values. It's redefined here in order to make it work with QML.

This property was introduced in 4.43.

Access functions:

Kirigami::Platform::PlatformTheme::ColorGroup colorGroup() const
void setColorGroup(Kirigami::Platform::PlatformTheme::ColorGroup)

Notifier signal:

void colorGroupChanged(Kirigami::Platform::PlatformTheme::ColorGroup colorGroup)

colorSet : ColorSet

This enumeration describes the color set for which a color is being selected.

Color sets define a color "environment", suitable for drawing all parts of a given region. Colors from different sets should not be combined.

Access functions:

Kirigami::Platform::PlatformTheme::ColorSet colorSet() const
void setColorSet(Kirigami::Platform::PlatformTheme::ColorSet)

Notifier signal:

void colorSetChanged(Kirigami::Platform::PlatformTheme::ColorSet colorSet)

[read-only] defaultFont : const QFont

The default font

Access functions:

QFont defaultFont() const

Notifier signal:

void defaultFontChanged(const QFont &font)

disabledTextColor : QColor

Foreground color for disabled areas, usually a mid-gray @note Depending on the implementation, the color used for this property may not be based on the disabled palette. For example, for the Plasma implementation, "Inactive Text Color" of the active palette is used.

Access functions:

QColor disabledTextColor() const
void setCustomDisabledTextColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

focusColor : QColor

A decoration color that indicates active focus

Access functions:

QColor focusColor() const
void setCustomFocusColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

[read-only] frameContrast : const qreal

Frame contrast value, usually used for separators and outlines Value is between 0.0 and 1.0

Access functions:

qreal frameContrast() const

highlightColor : QColor

The background color for selected areas

Access functions:

QColor highlightColor() const
void setCustomHighlightColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

highlightedTextColor : QColor

Color for text that has been highlighted, often is a light color while normal text is dark

Access functions:

QColor highlightedTextColor() const
void setCustomHighlightedTextColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

hoverColor : QColor

A decoration color that indicates mouse hovering

Access functions:

QColor hoverColor() const
void setCustomHoverColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

inherit : bool

If true, the colorSet will be inherited from the colorset of a theme of one of the ancestor items default: true

Access functions:

bool inherit() const
void setInherit(bool inherit)

Notifier signal:

void inheritChanged(bool inherit)

[read-only] lightFrameContrast : const qreal

Returns half of the frameContrast value; used by Separator.Weight.Light Value is between 0.0 and 1.0

Access functions:

qreal lightFrameContrast() const

linkBackgroundColor : QColor

Background color for links

Access functions:

QColor linkBackgroundColor() const
void setCustomLinkBackgroundColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

linkColor : QColor

Color for links

Access functions:

QColor linkColor() const
void setCustomLinkColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

negativeBackgroundColor : QColor

Background color for negative areas, such as critical errors and destructive actions

Access functions:

QColor negativeBackgroundColor() const
void setCustomNegativeBackgroundColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

negativeTextColor : QColor

Foreground color for negative areas, such as critical error text

Access functions:

QColor negativeTextColor() const
void setCustomNegativeTextColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

neutralBackgroundColor : QColor

Background color for neutral areas, such as warnings (but not critical)

Access functions:

QColor neutralBackgroundColor() const
void setCustomNeutralBackgroundColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

neutralTextColor : QColor

Foreground color for neutral areas, such as warning texts (but not critical)

Access functions:

QColor neutralTextColor() const
void setCustomNeutralTextColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

[read-only] palette : const QPalette

Palette

Access functions:

QPalette palette() const

Notifier signal:

void paletteChanged(const QPalette &pal)

positiveBackgroundColor : QColor

Background color for positive areas, such as success messages and trusted content

Access functions:

QColor positiveBackgroundColor() const
void setCustomPositiveBackgroundColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

positiveTextColor : QColor

Success messages, trusted content

Access functions:

QColor positiveTextColor() const
void setCustomPositiveTextColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

[read-only] smallFont : const QFont

Small font

Access functions:

QFont smallFont() const

Notifier signal:

void smallFontChanged(const QFont &font)

textColor : QColor

Color for normal foregrounds, usually text, but not limited to it, anything that should be painted with a clear contrast should use this color

Access functions:

QColor textColor() const
void setCustomTextColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

useAlternateBackgroundColor : bool

Hint for item views to actually make use of the alternate background color feature

Access functions:

bool useAlternateBackgroundColor() const
void setUseAlternateBackgroundColor(bool alternate)

Notifier signal:

void useAlternateBackgroundColorChanged(bool alternate)

visitedLinkBackgroundColor : QColor

Background color for visited links, usually a bit darker than linkBackgroundColor

Access functions:

QColor visitedLinkBackgroundColor() const
void setCustomVisitedLinkBackgroundColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

visitedLinkColor : QColor

Color for visited links, usually a bit darker than linkColor

Access functions:

QColor visitedLinkColor() const
void setCustomVisitedLinkColor(const QColor &color = QColor())

Notifier signal:

void colorsChanged()

Member Function Documentation

[virtual invokable] QIcon PlatformTheme::iconFromTheme(const QString &name, const QColor &customColor = Qt::transparent)

This will be used by desktopicon to fetch icons with KIconLoader

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.