21 {
"macosx",
false,
true,
true},
22 {
"windows",
true,
false,
false},
24 {
"other",
true,
true,
false}
30void MakeSingleColorImage(QImage& img,
const QColor& colorbase)
32 img = img.convertToFormat(QImage::Format_ARGB32);
33 for (
int x = img.width(); x--; )
35 for (
int y = img.height(); y--; )
37 const QRgb rgb = img.pixel(x, y);
38 img.setPixel(x, y, qRgba(colorbase.red(), colorbase.green(), colorbase.blue(), qAlpha(rgb)));
43QIcon ColorizeIcon(
const QIcon& ico,
const QColor& colorbase)
46 for (
const QSize& sz : ico.availableSizes())
48 QImage img(ico.pixmap(sz).toImage());
49 MakeSingleColorImage(img, colorbase);
50 new_ico.addPixmap(QPixmap::fromImage(img));
55QImage ColorizeImage(
const QString& filename,
const QColor& colorbase)
58 MakeSingleColorImage(img, colorbase);
62QIcon ColorizeIcon(
const QString& filename,
const QColor& colorbase)
64 return QIcon(QPixmap::fromImage(ColorizeImage(filename, colorbase)));
80 return QApplication::palette().color(QPalette::WindowText);
86 QColor colorHighlightBg(QApplication::palette().color(QPalette::Highlight));
87 QColor colorHighlightFg(QApplication::palette().color(QPalette::HighlightedText));
88 const QColor colorText(QApplication::palette().color(QPalette::WindowText));
89 const int colorTextLightness = colorText.lightness();
90 if (abs(colorHighlightBg.lightness() - colorTextLightness) < abs(colorHighlightFg.lightness() - colorTextLightness)) {
91 return colorHighlightBg;
93 return colorHighlightFg;
101 return QImage(filename);
108 return QIcon(filename);
127 if (
platformId == platform_style.platformId) {
129 platform_style.platformId,
130 platform_style.imagesOnButtons,
131 platform_style.colorizeIcons,
132 platform_style.useExtraSpacing);