kcms/colors: Properly apply tinting to the window titlebar

Tint the window titlebars only when either the option to tint all colors with
accent color or the option to apply accent color to window titlebars is enabled 
or both), and in the latter case, the active window titlebars should be painted
in the accent color.

BUG: 455395
BUG: 454047
FIXED-IN: 5.25.3
wilder-5.26
Eugene Popov 4 years ago committed by Nate Graham
parent eaa44eb88f
commit 00a18a8c5a
  1. 23
      kcms/colors/colorsapplicator.cpp

@ -272,15 +272,24 @@ void applyScheme(const QString &colorSchemePath, KConfig *configOutput, KConfig:
++i;
}
if (hasAccent()) { // Titlebar accent colouring
if (hasAccent() && (tintAccent || applyAccentToTitlebar)) { // Titlebar accent colouring
const auto windowBackground = config->group("Colors:Window").readEntry<QColor>("BackgroundNormal", QColor());
const auto accentedWindowBackground = accentBackground(getAccent(), windowBackground);
const auto inactiveWindowBackground = tintColor(windowBackground, getAccent(), tintFactor);
groupWMOut.writeEntry("activeBackground", applyAccentToTitlebar ? accentedWindowBackground : inactiveWindowBackground);
groupWMOut.writeEntry("activeForeground", accentForeground(accentedWindowBackground, true));
groupWMOut.writeEntry("inactiveBackground", inactiveWindowBackground);
groupWMOut.writeEntry("inactiveForeground", accentForeground(inactiveWindowBackground, false));
if (tintAccent) {
const auto tintedWindowBackground = tintColor(windowBackground, getAccent(), tintFactor);
if (!applyAccentToTitlebar) {
groupWMOut.writeEntry("activeBackground", tintedWindowBackground);
groupWMOut.writeEntry("activeForeground", accentForeground(tintedWindowBackground, true));
}
groupWMOut.writeEntry("inactiveBackground", tintedWindowBackground);
groupWMOut.writeEntry("inactiveForeground", accentForeground(tintedWindowBackground, false));
}
if (applyAccentToTitlebar) {
const auto accentedWindowBackground = accentBackground(getAccent(), windowBackground);
groupWMOut.writeEntry("activeBackground", accentedWindowBackground);
groupWMOut.writeEntry("activeForeground", accentForeground(accentedWindowBackground, true));
}
}
const QStringList groupNameList{QStringLiteral("ColorEffects:Inactive"), QStringLiteral("ColorEffects:Disabled")};

Loading…
Cancel
Save