10 #include <QApplication> 27 } platform_styles[] = {
28 {
"macosx",
false,
true,
true},
29 {
"windows",
true,
true,
false},
31 {
"other",
true,
true,
false}
33 static const unsigned platform_styles_count =
sizeof(platform_styles)/
sizeof(*platform_styles);
38 void MakeSingleColorImage(QImage& img,
const QColor& colorbase)
40 img = img.convertToFormat(QImage::Format_ARGB32);
41 for (
int x = img.width(); x--; )
43 for (
int y = img.height(); y--; )
45 const QRgb rgb = img.pixel(x, y);
46 img.setPixel(x, y, qRgba(colorbase.red(), colorbase.green(), colorbase.blue(), qAlpha(rgb)));
51 QIcon ColorizeIcon(
const QIcon& ico,
const QColor& colorbase)
54 for (
const QSize sz : ico.availableSizes())
56 QImage img(ico.pixmap(sz).toImage());
57 MakeSingleColorImage(img, colorbase);
58 new_ico.addPixmap(QPixmap::fromImage(img));
63 QImage ColorizeImage(
const QString& filename,
const QColor& colorbase)
66 MakeSingleColorImage(img, colorbase);
70 QIcon ColorizeIcon(
const QString& filename,
const QColor& colorbase)
72 return QIcon(QPixmap::fromImage(ColorizeImage(filename, colorbase)));
88 const QColor colorHighlightBg(QApplication::palette().color(QPalette::Highlight));
89 const QColor colorHighlightFg(QApplication::palette().color(QPalette::HighlightedText));
90 const QColor colorText(QApplication::palette().color(QPalette::WindowText));
91 const int colorTextLightness = colorText.lightness();
93 if (abs(colorHighlightBg.lightness() - colorTextLightness) < abs(colorHighlightFg.lightness() - colorTextLightness))
94 colorbase = colorHighlightBg;
96 colorbase = colorHighlightFg;
100 textColor = QColor(QApplication::palette().color(QPalette::WindowText));
106 return QImage(filename);
113 return QIcon(filename);
120 icon.addPixmap(QPixmap(filenameOn), QIcon::Normal, QIcon::On);
121 icon.addPixmap(QPixmap(filenameOff), QIcon::Normal, QIcon::Off);
136 return ColorizeIcon(icon, color);
142 return QIcon(filename);
156 return ColorizeIcon(filename,
TextColor());
215 return QColor(21,20,17);
217 return QColor(
"#faf9f6");
265 for (
unsigned x=0; x<platform_styles_count; ++x)
267 if (platformId == platform_styles[x].platformId)
270 platform_styles[x].platformId,
#define COLOR_TOOLBAR_NOT_SELECTED_TEXT_DARK_MODE
#define COLOR_TOOLBAR_SELECTED_TEXT
#define COLOR_BACKGROUND_LIGHT
LIGHT MODE.
#define COLOR_LIGHT_BLUE_DARK
#define COLOR_DARK_ORANGE
#define COLOR_DARK_BLUE_DARK
#define COLOR_SHADOW_LIGHT
#define COLOR_WIDGET_BACKGROUND_DARK
DARK MODE.
#define COLOR_LIGHT_ORANGE
#define COLOR_TOOLBAR_NOT_SELECTED_TEXT
#define COLOR_SHADOW_DARK
#define COLOR_TOOLBAR_SELECTED_TEXT_DARK_MODE
#define COLOR_PRICING_WIDGET