Skip to content

Commit

Permalink
Better color palettes; style disabled widgets properly
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Dec 30, 2021
1 parent cbf6d6d commit 964aef9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/interface/fragment/SettingsFragment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 6 additions & 2 deletions src/utils/StyleHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
23 changes: 11 additions & 12 deletions src/utils/StyleHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -81,15 +81,14 @@ namespace ColorStyleProvider
static QMap<CS_UNIT> TABLE()
{
InitializableQMap<CS_UNIT> map;
map << QPair<CS_UNIT>("dark", ColorStyle(true, QColor(25, 25, 25), QColor(53, 53, 53), Qt::white, QColor(42, 130, 218)))
<< QPair<CS_UNIT>("gray", ColorStyle(true, QColor(83, 83, 125), QColor(49, 49, 74), Qt::white, QColor(151, 151, 184), QColor(144, 144, 179)))
<< QPair<CS_UNIT>("blue", ColorStyle(true, QColor(0, 0, 38), QColor(0, 0, 50), Qt::white, QColor(85, 0, 255)))
<< QPair<CS_UNIT>("darkblue", ColorStyle(true, QColor(14, 19, 29), QColor(19, 25, 38), Qt::white, QColor(70, 79, 89)))
<< QPair<CS_UNIT>("honeycomb", ColorStyle(false, QColor(185, 188, 182), QColor(212, 215, 208), Qt::black, QColor(243, 193, 41), Qt::white))
<< QPair<CS_UNIT>("black", ColorStyle(true, Qt::black, QColor(28, 28, 28), QColor(222, 222, 222), QColor(132, 132, 132)))
<< QPair<CS_UNIT>("darkgreen", ColorStyle(true, QColor(30, 30, 30), QColor(27, 34, 36), QColor(197, 209, 217), QColor(153, 199, 190)))
<< QPair<CS_UNIT>("green", ColorStyle(true, QColor(6, 29, 12), QColor(0, 12, 0), Qt::white, QColor(86, 191, 121)))
<< QPair<CS_UNIT>("stone", ColorStyle(true, QColor(27, 36, 40), QColor(34, 45, 50), Qt::white, QColor(165, 206, 255)));
map << QPair<CS_UNIT>("dark", ColorStyle(true, QColor(25, 25, 25), QColor(53, 53, 53), Qt::white, QColor(42, 130, 218), Qt::black, QColor(140, 140, 140)))
<< QPair<CS_UNIT>("blue", ColorStyle(true, QColor(0, 0, 38), QColor(0, 0, 50), Qt::white, QColor(85, 0, 255), Qt::black, QColor(85, 85, 85)))
<< QPair<CS_UNIT>("darkblue", ColorStyle(true, QColor(14, 19, 29), QColor(19, 25, 38), Qt::white, QColor(70, 79, 89), Qt::black, QColor(85, 85, 85)))
<< QPair<CS_UNIT>("honeycomb", ColorStyle(false, QColor(205, 208, 202), QColor(212, 215, 208), Qt::black, QColor(243, 193, 41), Qt::white, QColor(85, 85, 85)))
<< QPair<CS_UNIT>("black", ColorStyle(true, Qt::black, QColor(28, 28, 28), QColor(222, 222, 222), QColor(132, 132, 132), Qt::black, QColor(140, 140, 140)))
<< QPair<CS_UNIT>("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<CS_UNIT>("green", ColorStyle(true, QColor(6, 29, 12), QColor(0, 12, 0), Qt::white, QColor(86, 191, 121), Qt::black, QColor(102, 111, 102)))
<< QPair<CS_UNIT>("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);
}

Expand Down

0 comments on commit 964aef9

Please sign in to comment.