diff --git a/src/plasma/CMakeLists.txt b/src/plasma/CMakeLists.txt index 160d09b5e..1cc9ae329 100644 --- a/src/plasma/CMakeLists.txt +++ b/src/plasma/CMakeLists.txt @@ -125,6 +125,7 @@ PRIVATE KF5::XmlGui #KActionCollection KF5::GlobalAccel #Applet::setGlobalShortcut KF5::Notifications + KF5::IconThemes ${PLASMA_EXTRA_LIBS} ) diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp index 08c93fa54..f3c1e8994 100644 --- a/src/plasma/private/theme_p.cpp +++ b/src/plasma/private/theme_p.cpp @@ -346,6 +346,11 @@ void ThemePrivate::scheduledCacheUpdate() void ThemePrivate::colorsChanged() { + // in the case the theme follows the desktop settings, refetch the colorschemes + // and discard the svg pixmap cache + if (!colors) { + KSharedConfig::openConfig()->reparseConfiguration(); + } colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors); buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors); viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors); diff --git a/src/plasma/svg.cpp b/src/plasma/svg.cpp index 3e609a505..68c912004 100644 --- a/src/plasma/svg.cpp +++ b/src/plasma/svg.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "applet.h" #include "package.h" @@ -382,6 +383,13 @@ QPixmap SvgPrivate::findInCache(const QString &elementId, const QSizeF &s) renderPainter.end(); + // Apply current color scheme if the svg asks for it + if (applyColors) { + QImage itmp = p.toImage(); + KIconEffect::colorize(itmp, cacheAndColorsTheme()->color(Theme::BackgroundColor), 1.0); + p = p.fromImage(itmp); + } + if (cacheRendering) { cacheAndColorsTheme()->insertIntoCache(id, p, QString::number((qint64)q, 16) % QLSEP % actualElementId); } @@ -550,7 +558,10 @@ QMatrix SvgPrivate::matrixForElement(const QString &elementId) void SvgPrivate::checkColorHints() { - if (elementRect("current-color-scheme").isValid()) { + if (elementRect("hint-apply-color-scheme").isValid()) { + applyColors = true; + usesColors = true; + } else if (elementRect("current-color-scheme").isValid()) { applyColors = false; usesColors = true; } else {