Merge pull request #1198 from rnhmjoj/pr-green

Add green theme color, make "error" configurable
This commit is contained in:
DeepBlueV7.X 2022-10-01 13:45:26 +00:00 committed by GitHub
commit f8724fdea8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 13 deletions

View file

@ -79,9 +79,9 @@ AbstractButton {
function updatePresence() { function updatePresence() {
switch (Presence.userPresence(userid)) { switch (Presence.userPresence(userid)) {
case "online": case "online":
return "#00cc66"; return Nheko.theme.green;
case "unavailable": case "unavailable":
return "#ff9933"; return Nheko.theme.red;
case "offline": case "offline":
default: default:
// return "#a82353" don't show anything if offline, since it is confusing, if presence is disabled // return "#a82353" don't show anything if offline, since it is confusing, if presence is disabled

View file

@ -40,7 +40,7 @@ Image {
if (encrypted) { if (encrypted) {
switch (trust) { switch (trust) {
case Crypto.Verified: case Crypto.Verified:
return sourceUrl + "green"; return sourceUrl + Nheko.theme.green;
case Crypto.TOFU: case Crypto.TOFU:
return sourceUrl + Nheko.colors.buttonText; return sourceUrl + Nheko.colors.buttonText;
default: default:

View file

@ -313,13 +313,13 @@ ApplicationWindow {
source: { source: {
switch (verificationStatus) { switch (verificationStatus) {
case VerificationStatus.VERIFIED: case VerificationStatus.VERIFIED:
return "image://colorimage/:/icons/icons/ui/shield-filled-checkmark.svg?green"; return "image://colorimage/:/icons/icons/ui/shield-filled-checkmark.svg?" + Nheko.theme.green;
case VerificationStatus.UNVERIFIED: case VerificationStatus.UNVERIFIED:
return "image://colorimage/:/icons/icons/ui/shield-filled-exclamation-mark.svg?#d6c020"; return "image://colorimage/:/icons/icons/ui/shield-filled-exclamation-mark.svg?" + Nheko.theme.orange;
case VerificationStatus.SELF: case VerificationStatus.SELF:
return "image://colorimage/:/icons/icons/ui/checkmark.svg?green"; return "image://colorimage/:/icons/icons/ui/checkmark.svg?" + Nheko.theme.green;
default: default:
return "image://colorimage/:/icons/icons/ui/shield-filled-cross.svg?#d6c020"; return "image://colorimage/:/icons/icons/ui/shield-filled-cross.svg?" + Nheko.theme.orange;
} }
} }
} }
@ -394,13 +394,13 @@ ApplicationWindow {
source: { source: {
switch (verificationStatus) { switch (verificationStatus) {
case VerificationStatus.VERIFIED: case VerificationStatus.VERIFIED:
return "image://colorimage/:/icons/icons/ui/shield-filled-checkmark.svg?green"; return "image://colorimage/:/icons/icons/ui/shield-filled-checkmark.svg?" + Nheko.theme.green;
case VerificationStatus.UNVERIFIED: case VerificationStatus.UNVERIFIED:
return "image://colorimage/:/icons/icons/ui/shield-filled-exclamation-mark.svg?#d6c020"; return "image://colorimage/:/icons/icons/ui/shield-filled-exclamation-mark.svg?" + Nheko.theme.orange;
case VerificationStatus.SELF: case VerificationStatus.SELF:
return "image://colorimage/:/icons/icons/ui/checkmark.svg?green"; return "image://colorimage/:/icons/icons/ui/checkmark.svg?" + Nheko.theme.green;
default: default:
return "image://colorimage/:/icons/icons/ui/shield-filled.svg?red"; return "image://colorimage/:/icons/icons/ui/shield-filled.svg?" + Nheko.theme.red;
} }
} }
} }

View file

@ -69,16 +69,22 @@ Theme::Theme(QStringView theme)
sidebarBackground_ = QColor(0x23, 0x36, 0x49); sidebarBackground_ = QColor(0x23, 0x36, 0x49);
alternateButton_ = QColor(0xcc, 0xcc, 0xcc); alternateButton_ = QColor(0xcc, 0xcc, 0xcc);
red_ = QColor(0xa8, 0x23, 0x53); red_ = QColor(0xa8, 0x23, 0x53);
green_ = QColor("green");
orange_ = QColor(0xfc, 0xbe, 0x05); orange_ = QColor(0xfc, 0xbe, 0x05);
error_ = QColor("#dd3d3d");
} else if (theme == u"dark") { } else if (theme == u"dark") {
sidebarBackground_ = QColor(0x2d, 0x31, 0x39); sidebarBackground_ = QColor(0x2d, 0x31, 0x39);
alternateButton_ = QColor(0x41, 0x4A, 0x59); alternateButton_ = QColor(0x41, 0x4A, 0x59);
red_ = QColor(0xa8, 0x23, 0x53); red_ = QColor(0xa8, 0x23, 0x53);
green_ = QColor("green");
orange_ = QColor(0xfc, 0xc5, 0x3a); orange_ = QColor(0xfc, 0xc5, 0x3a);
error_ = QColor("#dd3d3d");
} else { } else {
sidebarBackground_ = p.window().color(); sidebarBackground_ = p.window().color();
alternateButton_ = p.dark().color(); alternateButton_ = p.dark().color();
red_ = QColor(Qt::GlobalColor::red); red_ = QColor(Qt::GlobalColor::red);
green_ = QColor("green");
orange_ = QColor(0xff, 0xa5, 0x00); // SVG orange orange_ = QColor(0xff, 0xa5, 0x00); // SVG orange
error_ = QColor("#dd3d3d");
} }
} }

View file

@ -15,6 +15,7 @@ class Theme : public QPalette
Q_PROPERTY(QColor alternateButton READ alternateButton CONSTANT) Q_PROPERTY(QColor alternateButton READ alternateButton CONSTANT)
Q_PROPERTY(QColor separator READ separator CONSTANT) Q_PROPERTY(QColor separator READ separator CONSTANT)
Q_PROPERTY(QColor red READ red CONSTANT) Q_PROPERTY(QColor red READ red CONSTANT)
Q_PROPERTY(QColor green READ green CONSTANT)
Q_PROPERTY(QColor error READ error CONSTANT) Q_PROPERTY(QColor error READ error CONSTANT)
Q_PROPERTY(QColor orange READ orange CONSTANT) Q_PROPERTY(QColor orange READ orange CONSTANT)
public: public:
@ -26,9 +27,10 @@ public:
QColor alternateButton() const { return alternateButton_; } QColor alternateButton() const { return alternateButton_; }
QColor separator() const { return separator_; } QColor separator() const { return separator_; }
QColor red() const { return red_; } QColor red() const { return red_; }
QColor error() const { return QColor(0xdd, 0x3d, 0x3d); } QColor green() const { return green_; }
QColor error() const { return error_; }
QColor orange() const { return orange_; } QColor orange() const { return orange_; }
private: private:
QColor sidebarBackground_, separator_, red_, orange_, alternateButton_; QColor sidebarBackground_, separator_, red_, green_, error_, orange_, alternateButton_;
}; };