diff --git a/src/gui/utils.cpp b/src/gui/utils.cpp index b40dcbbf6..99d31997c 100644 --- a/src/gui/utils.cpp +++ b/src/gui/utils.cpp @@ -34,8 +34,10 @@ #endif #include +#include #include #include +#include #include #include #include @@ -54,6 +56,13 @@ #include "base/utils/fs.h" #include "base/utils/version.h" +bool Utils::Gui::isDarkTheme() +{ + const QPalette palette = qApp->palette(); + const QColor &color = palette.color(QPalette::Active, QPalette::Base); + return (color.lightness() < 127); +} + QPixmap Utils::Gui::scaledPixmap(const QIcon &icon, const QWidget *widget, const int height) { Q_UNUSED(widget); // TODO: remove it diff --git a/src/gui/utils.h b/src/gui/utils.h index 58c9ac27f..ccf67f172 100644 --- a/src/gui/utils.h +++ b/src/gui/utils.h @@ -38,6 +38,8 @@ class QWidget; namespace Utils::Gui { + bool isDarkTheme(); + QPixmap scaledPixmap(const QIcon &icon, const QWidget *widget, int height); QPixmap scaledPixmap(const Path &path, const QWidget *widget, int height = 0); QPixmap scaledPixmapSvg(const Path &path, const QWidget *widget, int height);