Qt: Add new theme "Grey Matter"

This commit is contained in:
KamFretoZ 2024-02-05 21:46:01 +07:00 committed by Connor McLaughlin
parent 10616162f0
commit d9846093c3
2 changed files with 36 additions and 1 deletions

View File

@ -15,12 +15,13 @@ const char* GeneralSettingsWidget::THEME_NAMES[] = {
QT_TRANSLATE_NOOP("MainWindow", "Fusion"), QT_TRANSLATE_NOOP("MainWindow", "Fusion"),
QT_TRANSLATE_NOOP("MainWindow", "Dark Fusion (Gray)"), QT_TRANSLATE_NOOP("MainWindow", "Dark Fusion (Gray)"),
QT_TRANSLATE_NOOP("MainWindow", "Dark Fusion (Blue)"), QT_TRANSLATE_NOOP("MainWindow", "Dark Fusion (Blue)"),
QT_TRANSLATE_NOOP("MainWindow", "Grey Matter"),
QT_TRANSLATE_NOOP("MainWindow", "QDarkStyle"), QT_TRANSLATE_NOOP("MainWindow", "QDarkStyle"),
nullptr, nullptr,
}; };
const char* GeneralSettingsWidget::THEME_VALUES[] = { const char* GeneralSettingsWidget::THEME_VALUES[] = {
"", "fusion", "darkfusion", "darkfusionblue", "qdarkstyle", nullptr, "", "fusion", "darkfusion", "darkfusionblue", "greymatter", "qdarkstyle", nullptr,
}; };
const char* GeneralSettingsWidget::DEFAULT_THEME_NAME = "darkfusion"; const char* GeneralSettingsWidget::DEFAULT_THEME_NAME = "darkfusion";

View File

@ -2253,6 +2253,40 @@ void MainWindow::setStyleFromSettings()
qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }"); 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 else
{ {
qApp->setStyle(s_unthemed_style_name); qApp->setStyle(s_unthemed_style_name);