Skip to content

Commit

Permalink
Qt: Add new theme "Grey Matter"
Browse files Browse the repository at this point in the history
  • Loading branch information
kamfretoz authored and stenzek committed Feb 6, 2024
1 parent 1061616 commit d984609
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/duckstation-qt/generalsettingswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ const char* GeneralSettingsWidget::THEME_NAMES[] = {
QT_TRANSLATE_NOOP("MainWindow", "Fusion"),
QT_TRANSLATE_NOOP("MainWindow", "Dark Fusion (Gray)"),
QT_TRANSLATE_NOOP("MainWindow", "Dark Fusion (Blue)"),
QT_TRANSLATE_NOOP("MainWindow", "Grey Matter"),
QT_TRANSLATE_NOOP("MainWindow", "QDarkStyle"),
nullptr,
};

const char* GeneralSettingsWidget::THEME_VALUES[] = {
"", "fusion", "darkfusion", "darkfusionblue", "qdarkstyle", nullptr,
"", "fusion", "darkfusion", "darkfusionblue", "greymatter", "qdarkstyle", nullptr,
};

const char* GeneralSettingsWidget::DEFAULT_THEME_NAME = "darkfusion";
Expand Down
34 changes: 34 additions & 0 deletions src/duckstation-qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2253,6 +2253,40 @@ void MainWindow::setStyleFromSettings()

qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }");
}
else if (theme == "greymatter")
{
qApp->setStyle(QStyleFactory::create("Fusion"));

const QColor darkGray(46, 52, 64);
const QColor lighterGray(59, 66, 82);
const QColor gray(111, 111, 111);
const QColor blue(198, 238, 255);

QPalette darkPalette;
darkPalette.setColor(QPalette::Window, darkGray);
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Base, lighterGray);
darkPalette.setColor(QPalette::AlternateBase, darkGray);
darkPalette.setColor(QPalette::ToolTipBase, darkGray);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);
darkPalette.setColor(QPalette::Button, lighterGray);
darkPalette.setColor(QPalette::ButtonText, Qt::white);
darkPalette.setColor(QPalette::Link, blue);
darkPalette.setColor(QPalette::Highlight, lighterGray.darker());
darkPalette.setColor(QPalette::HighlightedText, Qt::white);
darkPalette.setColor(QPalette::PlaceholderText, QColor(Qt::white).darker());

darkPalette.setColor(QPalette::Active, QPalette::Button, lighterGray);
darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, gray.lighter());
darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, gray.lighter());
darkPalette.setColor(QPalette::Disabled, QPalette::Text, gray.lighter());
darkPalette.setColor(QPalette::Disabled, QPalette::Light, darkGray);

qApp->setPalette(darkPalette);

qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #505a70; border: 1px solid white; }");
}
else
{
qApp->setStyle(s_unthemed_style_name);
Expand Down

0 comments on commit d984609

Please sign in to comment.