Pages
API Documentation
On this page

Plasma::Theme Class

Interface to the Plasma theme. More...

  • Header: #include <Plasma/Theme>
  • CMake: find_package(Plasma REQUIRED)
    target_link_libraries(mytarget PRIVATE Plasma::Plasma)
  • Inherits: QObject

List of all members, including inherited members

Public Types

Properties

Public Functions

Static Public Members

Detailed Description

Plasma::Theme provides access to a common and standardized set of graphic elements stored in SVG format. This allows artists to create single packages of SVGs that will affect the look and feel of all workspace components.

Plasma::Theme can also be used directly to retrieve file system paths to SVGs by name.

Member Type Documentation

enum Theme::ColorRole

Constant Value Description
Plasma::Theme::TextColor 0 The text color to be used by items resting on the background
Plasma::Theme::BackgroundColor 1 The default background color
Plasma::Theme::HighlightColor 2 The text highlight color to be used by items resting on the background
Plasma::Theme::HoverColor 3 Color for hover effect on view
Plasma::Theme::FocusColor 4 Color for focus effect on view
Plasma::Theme::LinkColor 5 Color for clickable links
Plasma::Theme::VisitedLinkColor 6 Color visited clickable links
Plasma::Theme::HighlightedTextColor 7 Color contrasting with HighlightColor, to be used for instance with
Plasma::Theme::PositiveTextColor 8 Color of foreground objects with a "positive message" connotation (usually green)
Plasma::Theme::NeutralTextColor 9 Color of foreground objects with a "neutral message" connotation (usually yellow)
Plasma::Theme::NegativeTextColor 10 Color of foreground objects with a "negative message" connotation (usually red)
Plasma::Theme::DisabledTextColor (since Qt 5.64) 11 color of disabled text

Property Documentation

[read-only] backgroundContrast : qreal

Access functions:

[read-only] backgroundIntensity : qreal

Access functions:

[read-only] backgroundSaturation : qreal

Access functions:

[read-only] palette : QPalette

Access functions:

[read-only] themeName : QString

Access functions:

[read-only] useGlobalSettings : bool

Access functions:

Member Function Documentation

[explicit] Theme::Theme(QObject *parent = nullptr)

Default constructor. It will be the global theme configured in plasmarc

parent the parent object

[explicit] Theme::Theme(const QString &themeName, QObject *parent = nullptr)

Construct a theme. It will be a custom theme instance of themeName.

themeName the name of the theme to create

parent the parent object

bool Theme::adaptiveTransparencyEnabled() const

This method allows Plasma to enable and disable the adaptive transparency option of the panel, which allows user to decide whether the panel should be always transparent, always opaque or only opaque when a window is maximized. The configuration in the metadata.desktop file of the theme could look like this (for a lighter background):

[AdaptiveTransparency]
enabled=true

Returns Whether or not to enable the adaptive transparency

qreal Theme::backgroundContrast() const

This method allows Plasma to set a background contrast effect for a given theme, improving readability. The value is read from the "contrast" key in the "ContrastEffect" group in the Theme's metadata file.

Returns The contrast provided to the contrasteffect

Note: Getter function for property backgroundContrast.

See also backgroundContrastEnabled

bool Theme::backgroundContrastEnabled() const

This method allows Plasma to enable and disable the background contrast effect for a given theme, improving readability. The value is read from the "enabled" key in the "ContrastEffect" group in the Theme's metadata file. The configuration in the metadata.desktop file of the theme could look like this (for a lighter background):

[ContrastEffect]
enabled=true
contrast=0.45
intensity=0.45
saturation=1.7

Returns Whether or not to enable the contrasteffect

qreal Theme::backgroundIntensity() const

This method allows Plasma to set a background contrast effect for a given theme, improving readability. The value is read from the "intensity" key in the "ContrastEffect" group in the Theme's metadata file.

Returns The intensity provided to the contrasteffect

Note: Getter function for property backgroundIntensity.

See also backgroundContrastEnabled

qreal Theme::backgroundSaturation() const

This method allows Plasma to set a background contrast effect for a given theme, improving readability. The value is read from the "saturation" key in the "ContrastEffect" group in the Theme's metadata file.

Returns The saturation provided to the contrasteffect

Note: Getter function for property backgroundSaturation.

See also backgroundContrastEnabled

bool Theme::blurBehindEnabled() const

This method allows Plasma to enable and disable the blurring of what is behind the background for a given theme. The value is read from the "enabled" key in the "BlurBehindEffect" group in the Theme's metadata file. Default is @c true.

The configuration in the metadata.desktop file of the theme could look like this:

[BlurBehindEffect]
enabled=false

Returns Whether or not to enable blurring of what is behind

QColor Theme::color(Plasma::Theme::ColorRole role, Kirigami::Platform::PlatformTheme::ColorSet group = Kirigami::Platform::PlatformTheme::ColorSet::Window) const

Returns the text color to be used by items resting on the background

role which role (usage pattern) to get the color for

group which group we want a color of

KSharedConfigPtr Theme::colorScheme() const

Returns the color scheme configurationthat goes along this theme.

This can be used with KStatefulBrush and KColorScheme to determine the proper colours to use along with the visual elements in this theme.

[since 6.6] QString Theme::defaultWallpaperTheme() const

Returns the default wallpaper theme associated with this theme.

This function was introduced in Qt 6.6.

[static] KSharedConfigPtr Theme::globalColorScheme()

[static] QPalette Theme::globalPalette()

KPluginMetaData Theme::metadata() const

Returns plugin metadata for this theme, with information such as name, description, author, website etc

QPalette Theme::palette() const

Returns a QPalette with the colors set as defined by the theme.

Note: Getter function for property palette.

void Theme::setThemeName(const QString &themeName)

Sets the current theme being used.

See also themeName()

void Theme::setUseGlobalSettings(bool useGlobal)

Tells the theme whether to follow the global settings or use application specific settings

useGlobal pass in true to follow the global settings

See also useGlobalSettings()

QString Theme::themeName() const

Returns the name of the theme.

Note: Getter function for property themeName.

See also setThemeName()

bool Theme::useGlobalSettings() const

Returns true if the global settings are followed, false if application specific settings are used.

Note: Getter function for property useGlobalSettings.

See also setUseGlobalSettings()

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.