Make the copy button switch light/dark theme (#3057)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -48,6 +48,10 @@ public:
|
||||
} input;
|
||||
} splits;
|
||||
|
||||
struct {
|
||||
QPixmap copy;
|
||||
} buttons;
|
||||
|
||||
void normalizeColor(QColor &color);
|
||||
|
||||
private:
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user