From 5054d46075af3e0105793fb0469e97c4a88c5f19 Mon Sep 17 00:00:00 2001 From: Anderson Cardoso <43047877+andercard0@users.noreply.github.com> Date: Thu, 14 Mar 2024 16:01:50 -0300 Subject: [PATCH] Add Theme - Ruby This PR adds the Ruby Dark theme from PCSX2 to Duckstation Thanks @KamFretoZ for the heads up, Credits custom palette @Daisouji --- .../interfacesettingswidget.cpp | 3 +- src/duckstation-qt/mainwindow.cpp | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/interfacesettingswidget.cpp b/src/duckstation-qt/interfacesettingswidget.cpp index c304e5832..0e019a99c 100644 --- a/src/duckstation-qt/interfacesettingswidget.cpp +++ b/src/duckstation-qt/interfacesettingswidget.cpp @@ -15,12 +15,13 @@ const char* InterfaceSettingsWidget::THEME_NAMES[] = { QT_TRANSLATE_NOOP("MainWindow", "Dark Fusion (Gray)"), QT_TRANSLATE_NOOP("MainWindow", "Dark Fusion (Blue)"), QT_TRANSLATE_NOOP("MainWindow", "Grey Matter"), + QT_TRANSLATE_NOOP("MainWindow", "Dark Ruby"), QT_TRANSLATE_NOOP("MainWindow", "QDarkStyle"), nullptr, }; const char* InterfaceSettingsWidget::THEME_VALUES[] = { - "", "fusion", "darkfusion", "darkfusionblue", "greymatter", "qdarkstyle", nullptr, + "", "fusion", "darkfusion", "darkfusionblue", "greymatter", "darkruby", "qdarkstyle", nullptr, }; const char* InterfaceSettingsWidget::DEFAULT_THEME_NAME = "darkfusion"; diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index ae065cb38..02bf38ab7 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -2343,6 +2343,38 @@ void MainWindow::setStyleFromSettings() qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #505a70; border: 1px solid white; }"); } + else if (theme == "darkruby") + { + qApp->setStyle(QStyleFactory::create("Fusion")); + + const QColor gray(128, 128, 128); + const QColor slate(18, 18, 18); + const QColor rubyish(172, 21, 31); + + QPalette darkPalette; + darkPalette.setColor(QPalette::Window, slate); + darkPalette.setColor(QPalette::WindowText, Qt::white); + darkPalette.setColor(QPalette::Base, slate.lighter()); + darkPalette.setColor(QPalette::AlternateBase, slate.lighter()); + darkPalette.setColor(QPalette::ToolTipBase, slate); + darkPalette.setColor(QPalette::ToolTipText, Qt::white); + darkPalette.setColor(QPalette::Text, Qt::white); + darkPalette.setColor(QPalette::Button, slate); + darkPalette.setColor(QPalette::ButtonText, Qt::white); + darkPalette.setColor(QPalette::Link, Qt::white); + darkPalette.setColor(QPalette::Highlight, rubyish); + darkPalette.setColor(QPalette::HighlightedText, Qt::white); + + darkPalette.setColor(QPalette::Active, QPalette::Button, slate); + darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, gray); + darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, gray); + darkPalette.setColor(QPalette::Disabled, QPalette::Text, gray); + darkPalette.setColor(QPalette::Disabled, QPalette::Light, slate.lighter()); + + qApp->setPalette(darkPalette); + + qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }"); + } else { qApp->setStyle(s_unthemed_style_name);