- Chnage some hard-coded colors to take into account their background. (#3654)

- Change some SVGs from black to white if their background is too dark.
This commit is contained in:
Rob Blanckaert 2019-03-13 16:11:30 -07:00 committed by GitHub
parent 7eb2e36740
commit a522255baf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 10 deletions

View file

@ -1,6 +1,8 @@
#include "pixmapgenerator.h"
#include "pb/serverinfo_user.pb.h"
#include <QApplication>
#include <QPainter>
#include <QPalette>
#include <cmath>
#ifdef _WIN32
#include "round.h"
@ -163,3 +165,16 @@ QPixmap LockPixmapGenerator::generatePixmap(int height)
}
QMap<int, QPixmap> LockPixmapGenerator::pmCache;
const QPixmap loadColorAdjustedPixmap(QString name)
{
if (qApp->palette().windowText().color().lightness() > 200) {
QImage img(name);
img.invertPixels();
QPixmap result;
result.convertFromImage(img);
return result;
} else {
return QPixmap(name);
}
}