From b6ae8d66ee064340af7a1b3b7da93191c7c11986 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 25 Dec 2018 19:11:59 +0200 Subject: [PATCH] identify single color background also --Latte now does not only identify background files but single colors also. At the same time the new implementation is multi-screen aware. That means that two different top panels at two different screens can be color independent, meaning the first could be lightish when it is transparent and the latter darkish BUG: 402143 --- liblatte2/plasma/extended/backgroundcache.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/liblatte2/plasma/extended/backgroundcache.cpp b/liblatte2/plasma/extended/backgroundcache.cpp index 7d2395ebc..ffd31fa95 100644 --- a/liblatte2/plasma/extended/backgroundcache.cpp +++ b/liblatte2/plasma/extended/backgroundcache.cpp @@ -188,14 +188,20 @@ float BackgroundCache::luminasFor(QString activity, QString screen, Plasma::Type float BackgroundCache::luminasFromFile(QString imageFile, Plasma::Types::Location location) { - QImage image(imageFile); - if (m_luminasCache.keys().contains(imageFile)) { if (m_luminasCache[imageFile].keys().contains(location)) { return m_luminasCache[imageFile].value(location); } } + //! if it is a color + if (imageFile.startsWith("#")) { + return Latte::colorLumina(QColor(imageFile)); + } + + //! if it is a local image + QImage image(imageFile); + if (image.format() != QImage::Format_Invalid) { int maskHeight = (0.08 * image.height()); int maskWidth = (0.05 * image.width());