adds a red theme

This commit is contained in:
NathanRetzlaff 2025-06-10 13:35:15 -04:00
parent 64bbedeb82
commit e4e08e8468
5 changed files with 55 additions and 15 deletions

View File

@ -6,7 +6,6 @@
"configurationType": "Release",
"buildRoot": "${projectDir}\\Build\\${name}",
"installRoot": "${projectDir}\\Install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64_x64" ],

View File

@ -120,6 +120,7 @@ void MainWindow::CreateActions() {
m_theme_act_group = new QActionGroup(this);
m_theme_act_group->addAction(ui->setThemeDark);
m_theme_act_group->addAction(ui->setThemeLight);
m_theme_act_group->addAction(ui->setThemeRed);
m_theme_act_group->addAction(ui->setThemeGreen);
m_theme_act_group->addAction(ui->setThemeBlue);
m_theme_act_group->addAction(ui->setThemeViolet);
@ -787,6 +788,14 @@ void MainWindow::CreateConnects() {
isIconBlack = true;
}
});
connect(ui->setThemeRed, &QAction::triggered, &m_window_themes, [this]() {
m_window_themes.SetWindowTheme(Theme::Red, ui->mw_searchbar);
Config::setMainWindowTheme(static_cast<int>(Theme::Red));
if (!isIconBlack) {
SetUiIcons(true);
isIconBlack = true;
}
});
connect(ui->setThemeGreen, &QAction::triggered, &m_window_themes, [this]() {
m_window_themes.SetWindowTheme(Theme::Green, ui->mw_searchbar);
Config::setMainWindowTheme(static_cast<int>(Theme::Green));
@ -989,6 +998,11 @@ void MainWindow::SetLastUsedTheme() {
isIconBlack = false;
SetUiIcons(false);
break;
case Theme::Red:
ui->setThemeRed->setChecked(true);
isIconBlack = false;
SetUiIcons(false);
break;
case Theme::Green:
ui->setThemeGreen->setChecked(true);
isIconBlack = false;

View File

@ -15,19 +15,19 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
"border-radius: 4px; padding: 5px; }"
"QLineEdit:focus {"
"border: 1px solid #2A82DA; }");
themePalette.setColor(QPalette::Window, QColor(50, 50, 50));
themePalette.setColor(QPalette::WindowText, Qt::white);
themePalette.setColor(QPalette::Base, QColor(20, 20, 20));
themePalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53));
themePalette.setColor(QPalette::ToolTipBase, QColor(20, 20, 20));
themePalette.setColor(QPalette::ToolTipText, Qt::white);
themePalette.setColor(QPalette::Text, Qt::white);
themePalette.setColor(QPalette::Button, QColor(53, 53, 53));
themePalette.setColor(QPalette::ButtonText, Qt::white);
themePalette.setColor(QPalette::BrightText, Qt::red);
themePalette.setColor(QPalette::Link, QColor(42, 130, 218));
themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
themePalette.setColor(QPalette::HighlightedText, Qt::black);
themePalette.setColor(QPalette::Window, QColor(50, 50, 50)); // Dark Gray
themePalette.setColor(QPalette::WindowText, Qt::white); // White
themePalette.setColor(QPalette::Base, QColor(20, 20, 20)); // Dark Dark Gray
themePalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53)); // Gray
themePalette.setColor(QPalette::ToolTipBase, QColor(20, 20, 20)); // Dark Dark Gray
themePalette.setColor(QPalette::ToolTipText, Qt::white); // White
themePalette.setColor(QPalette::Text, Qt::white); // White
themePalette.setColor(QPalette::Button, QColor(53, 53, 53)); // Gray
themePalette.setColor(QPalette::ButtonText, Qt::white); // White
themePalette.setColor(QPalette::BrightText, Qt::red); // Red
themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Blue
themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Blue
themePalette.setColor(QPalette::HighlightedText, Qt::black); // White
qApp->setPalette(themePalette);
break;
case Theme::Light:
@ -51,6 +51,27 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::HighlightedText, Qt::white); // White
qApp->setPalette(themePalette);
break;
case Theme::Red:
mw_searchbar->setStyleSheet(
"QLineEdit {"
"background-color: #0e0000; color: #ffffff; border: 1px solid #ffffff; "
"border-radius: 4px; padding: 5px; }"
"QLineEdit:focus {"
"border: 1px solid #2A82DA; }");
themePalette.setColor(QPalette::Window, QColor(70, 0, 0)); // red 3
themePalette.setColor(QPalette::WindowText, Qt::white); // White
themePalette.setColor(QPalette::Base, QColor(28, 0, 0, 80)); // red 4
themePalette.setColor(QPalette::AlternateBase, QColor(56, 0, 0)); // red 2
themePalette.setColor(QPalette::ToolTipBase, QColor(28, 0, 0, 80)); // red 4
themePalette.setColor(QPalette::ToolTipText, Qt::white); // White
themePalette.setColor(QPalette::Text, Qt::white); // White
themePalette.setColor(QPalette::ButtonText, Qt::white); // red 2
themePalette.setColor(QPalette::BrightText, Qt::red); // Red
themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Blue
themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Blue
themePalette.setColor(QPalette::HighlightedText, Qt::white); // White
qApp->setPalette(themePalette);
break;
case Theme::Green:
mw_searchbar->setStyleSheet(
"QLineEdit {"

View File

@ -7,7 +7,7 @@
#include <QLineEdit>
#include <QWidget>
enum class Theme : int { Dark, Light, Green, Blue, Violet, Gruvbox, TokyoNight, Oled };
enum class Theme : int { Dark, Light, Red, Green, Blue, Violet, Gruvbox, TokyoNight, Oled };
class WindowThemes : public QObject {
Q_OBJECT

View File

@ -34,6 +34,7 @@ public:
QAction* configureAct;
QAction* setThemeDark;
QAction* setThemeLight;
QAction* setThemeRed;
QAction* setThemeGreen;
QAction* setThemeBlue;
QAction* setThemeViolet;
@ -163,6 +164,9 @@ public:
setThemeLight = new QAction(MainWindow);
setThemeLight->setObjectName("setThemeLight");
setThemeLight->setCheckable(true);
setThemeRed = new QAction(MainWindow);
setThemeRed->setObjectName("setThemeRed");
setThemeRed->setCheckable(true);
setThemeGreen = new QAction(MainWindow);
setThemeGreen->setObjectName("setThemeGreen");
setThemeGreen->setCheckable(true);
@ -316,6 +320,7 @@ public:
menuView->addAction(menuThemes->menuAction());
menuThemes->addAction(setThemeDark);
menuThemes->addAction(setThemeLight);
menuThemes->addAction(setThemeRed);
menuThemes->addAction(setThemeGreen);
menuThemes->addAction(setThemeBlue);
menuThemes->addAction(setThemeViolet);
@ -404,6 +409,7 @@ public:
menuHelp->setTitle(QCoreApplication::translate("MainWindow", "Help", nullptr));
setThemeDark->setText(QCoreApplication::translate("MainWindow", "Dark", nullptr));
setThemeLight->setText(QCoreApplication::translate("MainWindow", "Light", nullptr));
setThemeRed->setText(QCoreApplication::translate("MainWindow", "Red", nullptr));
setThemeGreen->setText(QCoreApplication::translate("MainWindow", "Green", nullptr));
setThemeBlue->setText(QCoreApplication::translate("MainWindow", "Blue", nullptr));
setThemeViolet->setText(QCoreApplication::translate("MainWindow", "Violet", nullptr));