Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2020-10-26 18:49:10 +0300
committerHannah von Reth <vonreth@kde.org>2020-10-28 11:38:07 +0300
commit8fb364a913009acfcae5d3da02f95e2e5a3ef40b (patch)
tree256e988e38bb40ff32587b5cef05dd1d814a8d49 /src/gui/guiutility.cpp
parent2e8f660e2ade5b19a62286dddcc928cc707c08ed (diff)
Reintroduce a dark and a light theme
Diffstat (limited to 'src/gui/guiutility.cpp')
-rw-r--r--src/gui/guiutility.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/guiutility.cpp b/src/gui/guiutility.cpp
index 71cec1073..929404ca4 100644
--- a/src/gui/guiutility.cpp
+++ b/src/gui/guiutility.cpp
@@ -20,6 +20,7 @@
#include <QLoggingCategory>
#include <QMessageBox>
#include <QUrlQuery>
+#include <QIcon>
#include "theme.h"
@@ -97,3 +98,17 @@ QString Utility::vfsFreeSpaceActionText()
{
return QCoreApplication::translate("utility", "Free up local space");
}
+
+
+QIcon Utility::getCoreIcon(const QString &icon_name)
+{
+ if (icon_name.isEmpty()) {
+ return {};
+ }
+ const QColor bg(QPalette().base().color());
+ const double treshold = 1.0 - (0.299 * bg.red() + 0.587 * bg.green() + 0.114 * bg.blue()) / 255.0;
+ const QString path = treshold > 0.5 ? QStringLiteral("light") : QStringLiteral("dark");
+ const QIcon icon(QStringLiteral(":/client/resources/%1/%2").arg(path, icon_name));
+ Q_ASSERT(!icon.isNull());
+ return icon;
+}