From b352dea2dcc80dfee0647ea56aa45f57ef68293d Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sun, 25 Jul 2021 13:15:38 +0200 Subject: [PATCH] Make the copy button switch light/dark theme (#3057) Co-authored-by: Rasmus Karlsson --- CHANGELOG.md | 1 + resources/buttons/copyDark.png | Bin 1157 -> 1004 bytes resources/buttons/copyDark.svg | 2 +- resources/buttons/copyLight.png | Bin 1004 -> 1157 bytes resources/buttons/copyLight.svg | 2 +- src/singletons/Theme.cpp | 15 ++++++++++++++- src/singletons/Theme.hpp | 4 ++++ src/widgets/dialogs/UserInfoPopup.cpp | 3 ++- 8 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f29536b8..0a18cc9d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Minor: Received IRC messages use `time` message tag for timestamp if it's available. (#3021) - Minor: Added informative messages for recent-messages API's errors. (#3029) - Bugfix: Fixed "smiley" emotes being unable to be "Tabbed" with autocompletion, introduced in v2.3.3. (#3010) +- Bugfix: Copy buttons in usercard now show properly in light mode (#3057) - Bugfix: Fixed comma appended to username completion when not at the beginning of the message. (#3060) - Dev: Ubuntu packages are now available (#2936) - Dev: Disabled update checker on Flatpak. (#3051) diff --git a/resources/buttons/copyDark.png b/resources/buttons/copyDark.png index 2a663bfd6d9d5dcdb81ded3e4f469c6c5eb90d18..a0b633eec4f5420f4d98abba1a4f73ae312b87a2 100644 GIT binary patch delta 962 zcmV;z13mnO3G4@uIDZ44NklYl2vyLx6}c6206*1>%W*aD0fLq|(3yGCbUYq}XYp9Qu9FMoiqKvc2<(R={@wuB2s zw$o^z0IQ3BtIdLd*>}U&ta`w(o?JI$6iL|B)98RfAp~#-^i$U2W)FdVZQeA5fHvds z&AkMM+rV+aK0|!|!TOj8;Mw95#&{mM2#mQL>gZx3K+EGO9PR+iHOCNpN(3;kJ-{3= z!A=vB8Uf6CBY*H1*vd{_iHQK;8Q{us6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cbr%W0X2_?PccMDC-;)p92I+4XZ)`3^E$s1Ykp3Sn>TZ`gAzbA!%HsL$I3w z7(2}fR=}gnBt1|W6#{?@QUxgK3K=;Bp``QBjnWK2xM(t=8ep6}2Tq)P8npQojO1Zs z0wCN$rGLJ*I0FD2-5YvISDx#r-@|c|<|>pQ!!}*sV+-8}aI4JmVhtuB4&$Xu1(&jq zurUg!$I#N<9;HN-78~h9y>ACoq#ikpw7Wg(=z~oa9hqOsB=6;%-?Rd1BA8f`5hqb5CK2;*%TnR z$|^6q8*@J@3lF6gRspau>yKy#0M?3IWsc|1GBciLJAeU)SUs@=xF9*6fSn)gECqyh z>VJtHzy-|RNMMcqnC0I2-0IwKy?U+a9N0J%I@d2^8c zqch|%y@qcC-s$`^{y+jhXj)!fT|JLyqJLX3M!)8u5FNenN^#3IVVT1N0r8Z)F|;&{gjX z6BQ{15*hEXGW!Xv>D(CrKZGMfIWl ihLhu{(p{_(KK}uU6#m1T5kS}g0000 - + diff --git a/resources/buttons/copyLight.png b/resources/buttons/copyLight.png index a0b633eec4f5420f4d98abba1a4f73ae312b87a2..2a663bfd6d9d5dcdb81ded3e4f469c6c5eb90d18 100644 GIT binary patch delta 1116 zcmV-i1f%=x2ZafcIDZ5;NklY`l}hSc%95Nnv3pq82uO1O%}Z zMABG@h+t)F)WS*;Vp0lejFl+CRANAks1g4J8^xGJ?nuNh^y2UB?H-f6o%d$4d&f*} z2PQM~zUIB(%$xnlUVooOsaC6d3WdVR+S=Mds11aw{Vi=@KYxm1Ht5&u^)_0I+*GMl zx((Y$p!)&5ABv5Rbql7JYqeTAm&?t=!6oI9#6KF3(>T$GpVdFGt3+=)z`vyB13Oy$J0*%{ak@mB!hl%1NLv<(1umeY~m z1~X3q!WC5Y41Y<-I;^+^K>NYb2$OughdKrjjL)ows{Gd_03>fOL0}pnY?lOW_&xzZ zah*h+0|*tHAURpz0H9d*p}qkKhq%B@c`gBJhv;p}>nbE8psG=w-V z0EAz*-cbr%W0X2_?PccMD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k_~WNliHQIvx&wF%yao*Uc3Zw?-=%}POL!i1x->;6rV=pm@fCN{ zbQ)@x`sRu05cI{^sy-6{dQA{w)yydWJ`+ZE<@CgwLM9h>#LUAf50K^A1or%O#)? zl)O2YfU<7QV)ko}@TX23q= zTzRg6@|epoC^{Z;+yUc4LM)4Gz;nRVopCSssW0oweV30*r;TIj-r~Tz!o!U>OAX$W zJ%kXg1VZNOx3BmKY}H^g0buG|RkkAY6FZ;nRb%B2XyhQNdcy|&W}2F7878^``~p%q k2!9|>zMyGuv2fAlAL^z0ZKJ;az5oCK07*qoM6N<$g1Jq|_y7O^ diff --git a/resources/buttons/copyLight.svg b/resources/buttons/copyLight.svg index 5fddace4e..ed30f70a7 100644 --- a/resources/buttons/copyLight.svg +++ b/resources/buttons/copyLight.svg @@ -9,5 +9,5 @@ height="368.64pt" viewBox="0 0 368.64 368.64"> - + diff --git a/src/singletons/Theme.cpp b/src/singletons/Theme.cpp index 13e01bf87..2e73d1703 100644 --- a/src/singletons/Theme.cpp +++ b/src/singletons/Theme.cpp @@ -1,12 +1,15 @@ -#define LOOKUP_COLOR_COUNT 360 #include "singletons/Theme.hpp" + #include "Application.hpp" +#include "singletons/Resources.hpp" #include #include +#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) diff --git a/src/singletons/Theme.hpp b/src/singletons/Theme.hpp index 99905fa83..8b55dbab2 100644 --- a/src/singletons/Theme.hpp +++ b/src/singletons/Theme.hpp @@ -48,6 +48,10 @@ public: } input; } splits; + struct { + QPixmap copy; + } buttons; + void normalizeColor(QColor &color); private: diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 3c82d43f4..1f5c62afe 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -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