style: add rounded borders and focus color styling to the search bar (#1804)

This commit is contained in:
Richard Habitzreuter 2024-12-17 07:32:30 -03:00 committed by GitHub
parent c94645d950
commit 05a1523f0e
2 changed files with 37 additions and 28 deletions

View file

@ -921,6 +921,7 @@ void MainWindow::SetLastUsedTheme() {
ui->setThemeViolet->setChecked(true);
isIconBlack = false;
SetUiIcons(false);
break;
case Theme::Gruvbox:
ui->setThemeGruvbox->setChecked(true);
isIconBlack = false;

View file

@ -8,10 +8,12 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
switch (theme) {
case Theme::Dark:
mw_searchbar->setStyleSheet("background-color: #1e1e1e;" // Dark background
"color: #ffffff;" // White text
"border: 2px solid #ffffff;" // White border
"padding: 5px;");
mw_searchbar->setStyleSheet(
"QLineEdit {"
"background-color: #1e1e1e; color: #ffffff; border: 1px solid #ffffff; "
"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));
@ -28,10 +30,12 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
qApp->setPalette(themePalette);
break;
case Theme::Light:
mw_searchbar->setStyleSheet("background-color: #ffffff;" // Light gray background
"color: #000000;" // Black text
"border: 2px solid #000000;" // Black border
"padding: 5px;");
mw_searchbar->setStyleSheet(
"QLineEdit {"
"background-color: #ffffff; color: #000000; border: 1px solid #000000; "
"border-radius: 4px; padding: 5px; }"
"QLineEdit:focus {"
"border: 1px solid #2A82DA; }");
themePalette.setColor(QPalette::Window, QColor(240, 240, 240)); // Light gray
themePalette.setColor(QPalette::WindowText, Qt::black); // Black
themePalette.setColor(QPalette::Base, QColor(230, 230, 230, 80)); // Grayish
@ -46,12 +50,13 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::HighlightedText, Qt::white); // White
qApp->setPalette(themePalette);
break;
case Theme::Green:
mw_searchbar->setStyleSheet("background-color: #1e1e1e;" // Dark background
"color: #ffffff;" // White text
"border: 2px solid #ffffff;" // White border
"padding: 5px;");
mw_searchbar->setStyleSheet(
"QLineEdit {"
"background-color: #192819; color: #ffffff; border: 1px solid #ffffff; "
"border-radius: 4px; padding: 5px; }"
"QLineEdit:focus {"
"border: 1px solid #2A82DA; }");
themePalette.setColor(QPalette::Window, QColor(53, 69, 53)); // Dark green background
themePalette.setColor(QPalette::WindowText, Qt::white); // White text
themePalette.setColor(QPalette::Base, QColor(25, 40, 25)); // Darker green base
@ -66,15 +71,15 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
themePalette.setColor(QPalette::Link, QColor(42, 130, 218)); // Light blue links
themePalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); // Light blue highlight
themePalette.setColor(QPalette::HighlightedText, Qt::black); // Black highlighted text
qApp->setPalette(themePalette);
break;
case Theme::Blue:
mw_searchbar->setStyleSheet("background-color: #1e1e1e;" // Dark background
"color: #ffffff;" // White text
"border: 2px solid #ffffff;" // White border
"padding: 5px;");
mw_searchbar->setStyleSheet(
"QLineEdit {"
"background-color: #14283c; color: #ffffff; border: 1px solid #ffffff; "
"border-radius: 4px; padding: 5px; }"
"QLineEdit:focus {"
"border: 1px solid #2A82DA; }");
themePalette.setColor(QPalette::Window, QColor(40, 60, 90)); // Dark blue background
themePalette.setColor(QPalette::WindowText, Qt::white); // White text
themePalette.setColor(QPalette::Base, QColor(20, 40, 60)); // Darker blue base
@ -92,12 +97,13 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
qApp->setPalette(themePalette);
break;
case Theme::Violet:
mw_searchbar->setStyleSheet("background-color: #1e1e1e;" // Dark background
"color: #ffffff;" // White text
"border: 2px solid #ffffff;" // White border
"padding: 5px;");
mw_searchbar->setStyleSheet(
"QLineEdit {"
"background-color: #501e5a; color: #ffffff; border: 1px solid #ffffff; "
"border-radius: 4px; padding: 5px; }"
"QLineEdit:focus {"
"border: 1px solid #2A82DA; }");
themePalette.setColor(QPalette::Window, QColor(100, 50, 120)); // Violet background
themePalette.setColor(QPalette::WindowText, Qt::white); // White text
themePalette.setColor(QPalette::Base, QColor(80, 30, 90)); // Darker violet base
@ -116,10 +122,12 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
qApp->setPalette(themePalette);
break;
case Theme::Gruvbox:
mw_searchbar->setStyleSheet("background-color: #1d2021;"
"color: #f9f5d7;"
"border: 2px solid #f9f5d7;"
"padding: 5px;");
mw_searchbar->setStyleSheet(
"QLineEdit {"
"background-color: #1d2021; color: #f9f5d7; border: 1px solid #f9f5d7; "
"border-radius: 4px; padding: 5px; }"
"QLineEdit:focus {"
"border: 1px solid #83A598; }");
themePalette.setColor(QPalette::Window, QColor(29, 32, 33));
themePalette.setColor(QPalette::WindowText, QColor(249, 245, 215));
themePalette.setColor(QPalette::Base, QColor(29, 32, 33));