Commit a1e1a53f authored by David Redondo's avatar David Redondo 🏎

Color icons in titlebar if possible

Summary:
Some icons can be recolored. However if the titlebar color is different
compared to the normal color scheme, this can lead to bad contrast.

Test Plan:
Before:{F8201155} {F8201159}
After: {F8201139}{F8201144}

Reviewers: #plasma, #vdg, ngraham

Reviewed By: #vdg, ngraham

Subscribers: kossebau, ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D28330
parent 582f5eba
add_definitions(-DTRANSLATION_DOMAIN="breeze_kwin_deco")
find_package(KF5 REQUIRED COMPONENTS CoreAddons GuiAddons ConfigWidgets WindowSystem I18n)
find_package(KF5 REQUIRED COMPONENTS CoreAddons GuiAddons ConfigWidgets WindowSystem I18n IconThemes)
find_package(Qt5 CONFIG REQUIRED COMPONENTS DBus)
### XCB
......@@ -82,6 +82,7 @@ target_link_libraries(breezedecoration
KF5::ConfigWidgets
KF5::GuiAddons
KF5::I18n
KF5::IconThemes
KF5::WindowSystem)
if(BREEZE_HAVE_X11)
......
......@@ -22,6 +22,7 @@
#include <KDecoration2/DecoratedClient>
#include <KColorUtils>
#include <KIconLoader>
#include <QPainter>
#include <QVariantAnimation>
......@@ -143,8 +144,20 @@ namespace Breeze
{
const QRectF iconRect( geometry().topLeft(), m_iconSize );
decoration()->client().data()->icon().paint(painter, iconRect.toRect());
if (auto deco = qobject_cast<Decoration*>(decoration())) {
const QPalette activePalette = KIconLoader::global()->customPalette();
QPalette palette = decoration()->client().data()->palette();
palette.setColor(QPalette::Foreground, deco->fontColor());
KIconLoader::global()->setCustomPalette(palette);
decoration()->client().data()->icon().paint(painter, iconRect.toRect());
if (activePalette == QPalette()) {
KIconLoader::global()->resetPalette();
} else {
KIconLoader::global()->setCustomPalette(palette);
}
} else {
decoration()->client().data()->icon().paint(painter, iconRect.toRect());
}
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment