From 964aef94dbb278abf858bb607709425cd2e71497 Mon Sep 17 00:00:00 2001 From: Tim Schneeberger Date: Thu, 30 Dec 2021 13:12:18 +0100 Subject: [PATCH] Better color palettes; style disabled widgets properly --- src/interface/fragment/SettingsFragment.cpp | 3 +-- src/utils/StyleHelper.cpp | 8 +++++-- src/utils/StyleHelper.h | 23 ++++++++++----------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/interface/fragment/SettingsFragment.cpp b/src/interface/fragment/SettingsFragment.cpp index 7612e615..6e9b0948 100644 --- a/src/interface/fragment/SettingsFragment.cpp +++ b/src/interface/fragment/SettingsFragment.cpp @@ -64,8 +64,7 @@ SettingsFragment::SettingsFragment(TrayIcon *trayIcon, ui->paletteSelect->addItem("Dark", "dark"); ui->paletteSelect->addItem("Dark Blue", "darkblue"); ui->paletteSelect->addItem("Dark Green", "darkgreen"); - ui->paletteSelect->addItem("Honeycomb", "honeycomb"); - ui->paletteSelect->addItem("Gray", "gray"); + ui->paletteSelect->addItem("Honeycomb", "honeycomb"); ui->paletteSelect->addItem("Green", "green"); ui->paletteSelect->addItem("Stone", "stone"); ui->paletteSelect->addItem("Custom", "custom"); diff --git a/src/utils/StyleHelper.cpp b/src/utils/StyleHelper.cpp index fe4a51c4..dc48aa59 100644 --- a/src/utils/StyleHelper.cpp +++ b/src/utils/StyleHelper.cpp @@ -80,8 +80,12 @@ void StyleHelper::setPalette(const ColorStyle &s) palette->setColor(QPalette::BrightText, Qt::red); palette->setColor(QPalette::Link, QColor(42, 130, 218)); palette->setColor(QPalette::Highlight, s.selection); - palette->setColor(QPalette::HighlightedText, s.selectiontext); - qApp->setPalette(*palette); + palette->setColor(QPalette::HighlightedText, s.selectiontext); + palette->setColor(QPalette::Disabled, QPalette::Text, s.selectiontext); + palette->setColor(QPalette::Disabled, QPalette::WindowText, s.disabled); + palette->setColor(QPalette::Disabled, QPalette::ToolTipText, s.disabled); + palette->setColor(QPalette::Disabled, QPalette::ButtonText, s.disabled); + qApp->setPalette(*palette); qApp->setStyleSheet(QString(R"(QFrame[frameShape="4"], QFrame[frameShape="5"]{ color: gray; } diff --git a/src/utils/StyleHelper.h b/src/utils/StyleHelper.h index 5d67edc4..0e878fe8 100644 --- a/src/utils/StyleHelper.h +++ b/src/utils/StyleHelper.h @@ -60,9 +60,9 @@ class ColorStyle const QColor &_base, const QColor &_background, const QColor &_foreground, - const QColor &_selection = QColor(42, 130, 218), - const QColor &_selectiontext = Qt::black, - const QColor &_disabled = QColor(85, 85, 85)) + const QColor &_selection, + const QColor &_selectiontext, + const QColor &_disabled) { useWhiteIcons = _whiteIcons; base = _base; @@ -81,15 +81,14 @@ namespace ColorStyleProvider static QMap TABLE() { InitializableQMap map; - map << QPair("dark", ColorStyle(true, QColor(25, 25, 25), QColor(53, 53, 53), Qt::white, QColor(42, 130, 218))) - << QPair("gray", ColorStyle(true, QColor(83, 83, 125), QColor(49, 49, 74), Qt::white, QColor(151, 151, 184), QColor(144, 144, 179))) - << QPair("blue", ColorStyle(true, QColor(0, 0, 38), QColor(0, 0, 50), Qt::white, QColor(85, 0, 255))) - << QPair("darkblue", ColorStyle(true, QColor(14, 19, 29), QColor(19, 25, 38), Qt::white, QColor(70, 79, 89))) - << QPair("honeycomb", ColorStyle(false, QColor(185, 188, 182), QColor(212, 215, 208), Qt::black, QColor(243, 193, 41), Qt::white)) - << QPair("black", ColorStyle(true, Qt::black, QColor(28, 28, 28), QColor(222, 222, 222), QColor(132, 132, 132))) - << QPair("darkgreen", ColorStyle(true, QColor(30, 30, 30), QColor(27, 34, 36), QColor(197, 209, 217), QColor(153, 199, 190))) - << QPair("green", ColorStyle(true, QColor(6, 29, 12), QColor(0, 12, 0), Qt::white, QColor(86, 191, 121))) - << QPair("stone", ColorStyle(true, QColor(27, 36, 40), QColor(34, 45, 50), Qt::white, QColor(165, 206, 255))); + map << QPair("dark", ColorStyle(true, QColor(25, 25, 25), QColor(53, 53, 53), Qt::white, QColor(42, 130, 218), Qt::black, QColor(140, 140, 140))) + << QPair("blue", ColorStyle(true, QColor(0, 0, 38), QColor(0, 0, 50), Qt::white, QColor(85, 0, 255), Qt::black, QColor(85, 85, 85))) + << QPair("darkblue", ColorStyle(true, QColor(14, 19, 29), QColor(19, 25, 38), Qt::white, QColor(70, 79, 89), Qt::black, QColor(85, 85, 85))) + << QPair("honeycomb", ColorStyle(false, QColor(205, 208, 202), QColor(212, 215, 208), Qt::black, QColor(243, 193, 41), Qt::white, QColor(85, 85, 85))) + << QPair("black", ColorStyle(true, Qt::black, QColor(28, 28, 28), QColor(222, 222, 222), QColor(132, 132, 132), Qt::black, QColor(140, 140, 140))) + << QPair("darkgreen", ColorStyle(true, QColor(30, 30, 30), QColor(27, 34, 36), QColor(197, 209, 217), QColor(153, 199, 190), Qt::black, QColor(100, 100, 100))) + << QPair("green", ColorStyle(true, QColor(6, 29, 12), QColor(0, 12, 0), Qt::white, QColor(86, 191, 121), Qt::black, QColor(102, 111, 102))) + << QPair("stone", ColorStyle(true, QColor(27, 36, 40), QColor(34, 45, 50), Qt::white, QColor(165, 206, 255), Qt::black, QColor(115, 126, 129))); return std::move(map); }