Browse Source

Revive dark theme detection

The code was removed in 199d770e15 and now revived.
adaptive-webui-19844
Chocobo1 2 years ago
parent
commit
0e0b8d1027
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 9
      src/gui/utils.cpp
  2. 2
      src/gui/utils.h

9
src/gui/utils.cpp

@ -34,8 +34,10 @@ @@ -34,8 +34,10 @@
#endif
#include <QApplication>
#include <QColor>
#include <QDesktopServices>
#include <QIcon>
#include <QPalette>
#include <QPixmap>
#include <QPixmapCache>
#include <QPoint>
@ -54,6 +56,13 @@ @@ -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

2
src/gui/utils.h

@ -38,6 +38,8 @@ class QWidget; @@ -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);

Loading…
Cancel
Save