diff --git a/src/fillediconlabel.cpp b/src/fillediconlabel.cpp index bd7efdb..3161b0f 100644 --- a/src/fillediconlabel.cpp +++ b/src/fillediconlabel.cpp @@ -1,6 +1,8 @@ // Copyright 2019-2022 The Hush developers // Released under the GPLv3 #include "fillediconlabel.h" +#include "settings.h" +#include "guiconstants.h" FilledIconLabel::FilledIconLabel(QWidget* parent) : QLabel(parent) { @@ -20,8 +22,23 @@ void FilledIconLabel::resizeEvent(QResizeEvent*) { QPixmap scaled = basePm.scaled(sz, Qt::KeepAspectRatio, Qt::SmoothTransformation); + QString theme_name = Settings::getInstance()->get_theme_name(); + QColor color; + if (theme_name == "blue"){ + color = COLOR_BLUE_BG; + }else if(theme_name == "light"){ + color = COLOR_LIGHT_BG; + }else if(theme_name == "dark"){ + color = COLOR_DARK_BG; + }else if(theme_name =="midnight"){ + color = COLOR_MIDNIGHT_BG; + }else{ + color = COLOR_DEFAULT_BG; + } + QPixmap p(sz); - p.fill(Qt::white); + p.fill(color); + QPainter painter(&p); painter.drawPixmap((sz.width() - scaled.width()) / 2, (sz.height() - scaled.height()) / 2, scaled); diff --git a/src/guiconstants.h b/src/guiconstants.h index ac025a3..092f4ad 100644 --- a/src/guiconstants.h +++ b/src/guiconstants.h @@ -3,8 +3,16 @@ #ifndef GUICONSTANTS_H #define GUICONSTANTS_H +// Generic colors #define COLOR_BLACK QColor(0, 0, 0) #define COLOR_WHITE QColor(255, 255, 255) #define COLOR_UNCONFIRMED_TX QColor(255, 0, 0) +// Theme background colors +#define COLOR_DEFAULT_BG QColor(229, 229, 229) +#define COLOR_BLUE_BG QColor(229, 229, 229) +#define COLOR_LIGHT_BG QColor(218, 218, 218) +#define COLOR_DARK_BG QColor(48, 51, 53) +#define COLOR_MIDNIGHT_BG QColor(17, 17, 17) + #endif // GUICONSTANTS_H