diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index e4ac04e8d6ef2..b08ac34f0563d 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -60,6 +60,14 @@ using namespace Qt::StringLiterals; +#ifdef Q_OS_WIN + // "light" looks too bright on dark mode on Windows only + #define BACKGROUND_PALETTE "alternate-base" +#else + // ...and "alternate-base" looks too bright on macOS only. On Linux/Plasma either one looked fine ... + #define BACKGROUND_PALETTE "light" +#endif + #ifdef BUILD_FILE_PROVIDER_MODULE #include "macOS/fileprovider.h" #endif @@ -182,7 +190,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) const auto delegate = new FolderStatusDelegate; delegate->setParent(this); - setStyleSheet("QWidget#syncFoldersPanelContents, QWidget#connectionSettingsPanelContents, QWidget#fileProviderPanelContents { background: palette(alternate-base); }"_L1); + setStyleSheet("QWidget#syncFoldersPanelContents, QWidget#connectionSettingsPanelContents, QWidget#fileProviderPanelContents { background: palette(" BACKGROUND_PALETTE "); }"_L1); _ui->syncFoldersPanelContents->setAutoFillBackground(true); _ui->syncFoldersPanelContents->setAttribute(Qt::WA_StyledBackground, true); _ui->syncFoldersPanelContents->setContentsMargins(0, 0, 0, 0); @@ -199,7 +207,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) _ui->_folderList->header()->hide(); _ui->_folderList->setAutoFillBackground(true); _ui->_folderList->setAttribute(Qt::WA_StyledBackground, true); - _ui->_folderList->setStyleSheet(QStringLiteral("QTreeView { background: palette(alternate-base); }")); + _ui->_folderList->setStyleSheet(QStringLiteral("QTreeView { background: palette(" BACKGROUND_PALETTE "); }")); _ui->_folderList->setItemDelegate(delegate); _ui->_folderList->setModel(_model); _ui->_folderList->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); diff --git a/src/gui/macOS/ui/FileProviderSettings.qml b/src/gui/macOS/ui/FileProviderSettings.qml index 9f658fdb001a5..0b39dfe1af6c6 100644 --- a/src/gui/macOS/ui/FileProviderSettings.qml +++ b/src/gui/macOS/ui/FileProviderSettings.qml @@ -23,7 +23,7 @@ Page { title: qsTr("Virtual files settings") background: Rectangle { - color: palette.alternateBase + color: palette.light border.width: root.showBorder ? Style.normalBorderWidth : 0 border.color: palette.mid } diff --git a/src/gui/networksettings.cpp b/src/gui/networksettings.cpp index 81debd67cbbfc..e4edda10b4e71 100644 --- a/src/gui/networksettings.cpp +++ b/src/gui/networksettings.cpp @@ -21,6 +21,15 @@ #include #include +constexpr auto BACKGROUND_ROLE = +#ifdef Q_OS_WIN + // "light" looks too bright on dark mode on Windows only + QPalette::AlternateBase; +#else + // ...and "alternate-base" looks too bright on macOS only. On Linux/Plasma either one looked fine ... + QPalette::Light; +#endif + namespace OCC { NetworkSettings::NetworkSettings(const AccountPtr &account, QWidget *parent) @@ -30,13 +39,13 @@ NetworkSettings::NetworkSettings(const AccountPtr &account, QWidget *parent) { _ui->setupUi(this); setAutoFillBackground(true); - setBackgroundRole(QPalette::AlternateBase); + setBackgroundRole(BACKGROUND_ROLE); _ui->proxyGroupBox->setAutoFillBackground(true); - _ui->proxyGroupBox->setBackgroundRole(QPalette::AlternateBase); + _ui->proxyGroupBox->setBackgroundRole(BACKGROUND_ROLE); _ui->downloadBox->setAutoFillBackground(true); - _ui->downloadBox->setBackgroundRole(QPalette::AlternateBase); + _ui->downloadBox->setBackgroundRole(BACKGROUND_ROLE); _ui->uploadBox->setAutoFillBackground(true); - _ui->uploadBox->setBackgroundRole(QPalette::AlternateBase); + _ui->uploadBox->setBackgroundRole(BACKGROUND_ROLE); _ui->manualSettings->setVisible(_ui->manualProxyRadioButton->isChecked()); diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index eabd26f097cb6..910c9e19805df 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -42,6 +42,14 @@ using namespace Qt::StringLiterals; +#ifdef Q_OS_WIN + // "light" looks too bright on dark mode on Windows only + #define BACKGROUND_PALETTE "alternate-base" +#else + // ...and "alternate-base" looks too bright on macOS only. On Linux/Plasma either one looked fine ... + #define BACKGROUND_PALETTE "light" +#endif + namespace { class CurrentPageSizeStackedWidget : public QStackedWidget { @@ -434,7 +442,7 @@ void SettingsDialog::customizeStyle() "#Settings { background: palette(window); border-radius: 0; }" /* Navigation */ - "#settings_navigation, #settings_navigation_scroll { background: palette(alternate-base); border-radius: 12px; padding: 4px; }" + "#settings_navigation, #settings_navigation_scroll { background: palette(" BACKGROUND_PALETTE "); border-radius: 12px; padding: 4px; }" /* Content area */ "#settings_content, #settings_content_scroll { background: palette(window); border-radius: 12px; }" @@ -442,7 +450,7 @@ void SettingsDialog::customizeStyle() /* Panels */ "#generalGroupBox, #advancedGroupBox, #aboutAndUpdatesGroupBox," "#accountStatusPanel, #connectionSettingsPanel, #fileProviderPanel, #syncFoldersPanel {" - " background: palette(alternate-base);" + " background: palette(" BACKGROUND_PALETTE ");" " border-radius: 10px;" " margin: 0px;" " padding: 6px;"