From 00a18a8c5aeb6c0b4e2b157dec11e4e1032d20cd Mon Sep 17 00:00:00 2001 From: Eugene Popov Date: Tue, 5 Jul 2022 18:09:48 +0000 Subject: [PATCH] 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 --- kcms/colors/colorsapplicator.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/kcms/colors/colorsapplicator.cpp b/kcms/colors/colorsapplicator.cpp index e8d462057..385b818da 100644 --- a/kcms/colors/colorsapplicator.cpp +++ b/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("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")};