Make the copy button switch light/dark theme (#3057)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL
2021-07-25 13:15:38 +02:00
committed by GitHub
parent f949d6d154
commit b352dea2dc
8 changed files with 23 additions and 4 deletions
+14 -1
View File
@@ -1,12 +1,15 @@
#define LOOKUP_COLOR_COUNT 360
#include "singletons/Theme.hpp"
#include "Application.hpp"
#include "singletons/Resources.hpp"
#include <QColor>
#include <cmath>
#define LOOKUP_COLOR_COUNT 360
namespace chatterino {
Theme::Theme()
@@ -80,6 +83,16 @@ void Theme::actuallyUpdate(double hue, double multiplier)
this->splits.background = getColor(0, sat, 1);
this->splits.dropPreview = QColor(0, 148, 255, 0x30);
this->splits.dropPreviewBorder = QColor(0, 148, 255, 0xff);
// Copy button
if (this->isLightTheme())
{
this->buttons.copy = getResources().buttons.copyDark;
}
else
{
this->buttons.copy = getResources().buttons.copyLight;
}
}
void Theme::normalizeColor(QColor &color)
+4
View File
@@ -48,6 +48,10 @@ public:
} input;
} splits;
struct {
QPixmap copy;
} buttons;
void normalizeColor(QColor &color);
private:
+2 -1
View File
@@ -13,6 +13,7 @@
#include "providers/twitch/api/Kraken.hpp"
#include "singletons/Resources.hpp"
#include "singletons/Settings.hpp"
#include "singletons/Theme.hpp"
#include "util/Clipboard.hpp"
#include "util/Helpers.hpp"
#include "util/LayoutCreator.hpp"
@@ -42,7 +43,7 @@ namespace {
{
auto label = box.emplace<Label>();
auto button = box.emplace<Button>();
button->setPixmap(getResources().buttons.copyDark);
button->setPixmap(getApp()->themes->buttons.copy);
button->setScaleIndependantSize(18, 18);
button->setDim(Button::Dim::Lots);
QObject::connect(