KColorScheme
kcolorscheme.cpp
42 _effects[Intensity] = cfg.readEntry("IntensityEffect", (int)(state == QPalette::Disabled ? IntensityDarken : IntensityNoEffect));
43 _effects[Color] = cfg.readEntry("ColorEffect", (int)(state == QPalette::Disabled ? ColorNoEffect : ColorDesaturate));
44 _effects[Contrast] = cfg.readEntry("ContrastEffect", (int)(state == QPalette::Disabled ? ContrastFade : ContrastTint));
49 _color = cfg.readEntry("Color", state == QPalette::Disabled ? QColor(56, 56, 56) : QColor(112, 111, 110));
225 explicit KColorSchemePrivate(const KSharedConfigPtr &, QPalette::ColorGroup state, KColorScheme::ColorSet set);
230 void initFromConfig(const KSharedConfigPtr &config, QPalette::ColorGroup state, KColorScheme::ColorSet set);
252static SerializedColors loadSerializedColors(const KConfigGroup &group, const SerializedColors &defaults)
273static DecorationColors loadDecorationColors(const KConfigGroup &group, const DecorationColors &defaults)
281KColorSchemePrivate::KColorSchemePrivate(const KSharedConfigPtr &config, QPalette::ColorGroup state, KColorScheme::ColorSet set)
290void KColorSchemePrivate::initFromConfig(const KSharedConfigPtr &config, QPalette::ColorGroup state, KColorScheme::ColorSet set)
308 const bool inactiveSelectionEffect = inactiveEffectGroup.readEntry("ChangeSelectionColor", inactiveEffectGroup.readEntry("Enable", true));
317 tint = config->group(QStringLiteral("Colors:Selection")).readEntry("BackgroundNormal", defaultSelectionColors.NormalBackground);
333 defaultColors = loadSerializedColors(config->group(QStringLiteral("Colors:Window")), defaultHeaderColors);
334 defaultDecoColors = loadDecorationColors(config->group(QStringLiteral("Colors:Window")), defaultDecorationColors);
337 qCWarning(KCOLORSCHEME) << "ColorSet::NColorSets is not a valid color set value to pass to KColorScheme::KColorScheme";
392 _brushes.bg[KColorScheme::NormalBackground] = effects.brush(_brushes.bg[KColorScheme::NormalBackground]);
393 _brushes.bg[KColorScheme::AlternateBackground] = effects.brush(_brushes.bg[KColorScheme::AlternateBackground]);
417void KColorSchemePrivate::initFromSystemPalette(QPalette::ColorGroup state, KColorScheme::ColorSet set)
443 qCWarning(KCOLORSCHEME) << "ColorSet::NColorSets is not a valid color set value to pass to KColorScheme::KColorScheme";
465 _brushes.bg[KColorScheme::AlternateBackground] = systemPalette.color(state, QPalette::AlternateBase);
566QColor KColorScheme::shade(const QColor &color, ShadeRole role, qreal contrast, qreal chromaAdjust)
618void KColorScheme::adjustBackground(QPalette &palette, BackgroundRole newRole, QPalette::ColorRole color,
621 palette.setBrush(QPalette::Active, color, KColorScheme(QPalette::Active, set, config).background(newRole));
622 palette.setBrush(QPalette::Inactive, color, KColorScheme(QPalette::Inactive, set, config).background(newRole));
623 palette.setBrush(QPalette::Disabled, color, KColorScheme(QPalette::Disabled, set, config).background(newRole));
626void KColorScheme::adjustForeground(QPalette &palette, ForegroundRole newRole, QPalette::ColorRole color,
629 palette.setBrush(QPalette::Active, color, KColorScheme(QPalette::Active, set, config).foreground(newRole));
630 palette.setBrush(QPalette::Inactive, color, KColorScheme(QPalette::Inactive, set, config).foreground(newRole));
631 palette.setBrush(QPalette::Disabled, color, KColorScheme(QPalette::Disabled, set, config).foreground(newRole));
634bool KColorScheme::isColorSetSupported(const KSharedConfigPtr &config, KColorScheme::ColorSet set)
684 palette.setBrush(state, QPalette::PlaceholderText, schemeView.foreground(KColorScheme::InactiveText));
693 palette.setBrush(state, QPalette::AlternateBase, schemeView.background(KColorScheme::AlternateBackground));
695 palette.setBrush(state, QPalette::LinkVisited, schemeView.foreground(KColorScheme::VisitedText));
static void adjustForeground(QPalette &, ForegroundRole newRole=NormalText, QPalette::ColorRole color=QPalette::Text, ColorSet set=View, KSharedConfigPtr=KSharedConfigPtr())
Adjust a QPalette by replacing the specified QPalette::ColorRole with the requested foreground color ...
Definition kcolorscheme.cpp:626
ForegroundRole
This enumeration describes the foreground color being selected from the given set.
Definition kcolorscheme.h:209
@ ActiveText
Third color; for example items which are new, active, requesting attention, etc.
Definition kcolorscheme.h:225
@ NeutralText
Seventh color; for example, warnings, secure/encrypted content.
Definition kcolorscheme.h:248
@ InactiveText
Second color; for example, comments, items which are old, inactive or disabled.
Definition kcolorscheme.h:220
@ NegativeText
Sixth color; for example, errors, untrusted content, deletions, etc.
Definition kcolorscheme.h:244
@ PositiveText
Eighth color; for example, additions, success messages, trusted content.
Definition kcolorscheme.h:253
static QPalette createApplicationPalette(const KSharedConfigPtr &config)
Used to obtain the QPalette that will be used to set the application palette from KDE Platform theme.
Definition kcolorscheme.cpp:658
bool operator==(const KColorScheme &other) const
Definition kcolorscheme.cpp:522
ShadeRole
This enumeration describes the color shade being selected from the given set.
Definition kcolorscheme.h:295
@ LightShade
The light color is lighter than dark() or shadow() and contrasts with the base color.
Definition kcolorscheme.h:300
@ ShadowShade
The shadow color is darker than light() or midlight() and contrasts the base color.
Definition kcolorscheme.h:317
BackgroundRole
This enumeration describes the background color being selected from the given set.
Definition kcolorscheme.h:135
@ PositiveBackground
Eighth color; for example, success messages, trusted content.
Definition kcolorscheme.h:185
@ NeutralBackground
Seventh color; for example, warnings, secure/encrypted content.
Definition kcolorscheme.h:181
@ AlternateBackground
Alternate background; for example, for use in lists.
Definition kcolorscheme.h:146
@ ActiveBackground
Third color; for example, items which are new, active, requesting attention, etc.
Definition kcolorscheme.h:156
@ NegativeBackground
Sixth color; for example, errors, untrusted content, etc.
Definition kcolorscheme.h:177
ColorSet
This enumeration describes the color set for which a color is being selected.
Definition kcolorscheme.h:65
@ Header
Colors for header areas that should be used both by the top toolbar and the titlebar.
Definition kcolorscheme.h:117
static qreal contrastF(const KSharedConfigPtr &config=KSharedConfigPtr())
Returns the contrast for borders as a floating point value.
Definition kcolorscheme.cpp:531
static bool isColorSetSupported(const KSharedConfigPtr &config, KColorScheme::ColorSet set)
Used to check if the color scheme has a given set.
Definition kcolorscheme.cpp:634
QBrush background(BackgroundRole=NormalBackground) const
Retrieve the requested background brush.
Definition kcolorscheme.cpp:541
DecorationRole
This enumeration describes the decoration color being selected from the given set.
Definition kcolorscheme.h:270
@ HoverColor
Color used to draw decorations for items which will be activated by clicking.
Definition kcolorscheme.h:279
@ FocusColor
Color used to draw decorations for items which have input focus.
Definition kcolorscheme.h:274
static void adjustBackground(QPalette &, BackgroundRole newRole=NormalBackground, QPalette::ColorRole color=QPalette::Base, ColorSet set=View, KSharedConfigPtr=KSharedConfigPtr())
Adjust a QPalette by replacing the specified QPalette::ColorRole with the requested background color ...
Definition kcolorscheme.cpp:618
QBrush decoration(DecorationRole) const
Retrieve the requested decoration brush.
Definition kcolorscheme.cpp:551
QColor shade(ShadeRole) const
Retrieve the requested shade color, using KColorScheme::background(KColorScheme::NormalBackground) as...
Definition kcolorscheme.cpp:556
QBrush foreground(ForegroundRole=NormalText) const
Retrieve the requested foreground brush.
Definition kcolorscheme.cpp:546
QString readEntry(const char *key, const char *aDefault=nullptr) const
bool exists() const
KGUIADDONS_EXPORT QColor darken(const QColor &, qreal amount=0.5, qreal chromaGain=1.0)
KGUIADDONS_EXPORT qreal luma(const QColor &)
KGUIADDONS_EXPORT QColor shade(const QColor &, qreal lumaAmount, qreal chromaAmount=0.0)
KGUIADDONS_EXPORT QColor mix(const QColor &c1, const QColor &c2, qreal bias=0.5)
KGUIADDONS_EXPORT QColor tint(const QColor &base, const QColor &color, qreal amount=0.3)
KGUIADDONS_EXPORT QColor lighten(const QColor &, qreal amount=0.5, qreal chromaInverseGain=1.0)
KGuiItem defaults()
const QColor & color() const const
bool isValid() const const
ColorGroup
ButtonText
const QColor & color(ColorGroup group, ColorRole role) const const
void setBrush(ColorGroup group, ColorRole role, const QBrush &brush)
void setColor(ColorGroup group, ColorRole role, const QColor &color)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 25 2025 11:57:11 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 25 2025 11:57:11 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.