View Issue Details

IDProjectCategoryView StatusLast Update
0017391ScribusUser Interfacepublic2025-02-28 09:58
Reporternitramr Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
PlatformDesktop PCOSUbuntuOS Version24.10 64-bit
Product Version1.7.1.svn 
Target Version1.7 milestone 
Summary0017391: Add Dark/Light theme switch to override automatic mode
DescriptionStory
As a user, I want to be able to set the light and dark theme manually so that I can decide which UI theme Scribus is using independent of the OS UI theme.

Proposal:
Add a selection option in Settings --> User Interface where a user can select between:
- auto
- dark theme
- light theme

Options:
- Auto matches the light or dark mode of the OS and will change if the OS them changes. (this is the current implementation)
- Dark Theme: forces the dark mode (based on OS colors?)*
- Light Theme: forces the light mode (based on OS colors?)*

Acceptance Criteria:
- Theme change applies without restart (nice to have)
- Change is remembered in settings file (must have)


*) If the OS don't provide a color palette we can use to override the UI theme (e.g. OS is dark -> Scribus light), we have to define one by ourselves.
Additional InformationFeature Request: https://forums.scribus.net/index.php/topic,5854.0.html
TagsNo tags attached.
PatchYes

Relationships

related to 0017279 closed Workaround for QPalette bug 

Activities

ale

2025-01-27 18:11

manager   ~0051952

i would say that for a light system, the option could be:

- auto
- system dark (only if scribus thinks to be able to do the switch; or with a warning that it will only be possible if the system can provide the alternate theme)
- at least one light theme built into scribus
- at least one dark theme built into scribus

cbradney

2025-01-27 20:46

administrator   ~0051953

Qt Creator supports different light and dark themes. No idea how they do it. Otherwise, fine by me if we just have dark/light/auto.

nitramr

2025-02-24 22:41

developer   ~0052116

Looks like that Qt built the QPalette based on the system color palette. To force another color scheme other than the system's one, it requires a custom QPalette.

The following patch creates a custom color palette only if the user forces the color scheme and the system theme differs from setting. To change the mode, you can do this in Preferences -> User Interface -> Color Palette
The setting is saved in the preferences file too (name: ThemePalette).

The forced color palette is automatically generated by a base color, if it looks stupid on Windows or macOS, we can define another palette for each OS.
uitheme_2025-02-24_01.patch (14,451 bytes)   
Index: scribus/iconmanager.cpp
===================================================================
--- scribus/iconmanager.cpp	(Revision 26725)
+++ scribus/iconmanager.cpp	(Arbeitskopie)
@@ -139,11 +139,10 @@
 	{
 	case Qt::ColorScheme::Unknown:
 	case Qt::ColorScheme::Light:
+	default:
 		return false;
 	case Qt::ColorScheme::Dark:
 		return true;
-	default:
-		return false;
 	}
 #else
 	return (baseColor().lightness() >= 128) ? true : false;
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(Revision 26725)
+++ scribus/prefsmanager.cpp	(Arbeitskopie)
@@ -157,6 +157,7 @@
 	appPrefs.uiPrefs.mouseMoveTimeout = 150;
 	appPrefs.uiPrefs.wheelJump = 40;
 	appPrefs.uiPrefs.style = "";
+	appPrefs.uiPrefs.stylePalette = "auto";
 	// On Windows, use the Fusion theme by default when possible,
 	// the old Windows and windowsvista style do not support dark theme
 #if defined Q_OS_WINDOWS
@@ -1318,6 +1319,11 @@
 	return appPrefs.uiPrefs.style;
 }
 
+const QString& PrefsManager::guiStylePalette() const
+{
+	return appPrefs.uiPrefs.stylePalette;
+}
+
 const QString& PrefsManager::guiSystemStyle() const
 {
 	return appPrefs.ui_SystemTheme;
@@ -1360,6 +1366,7 @@
 	dcUI.setAttribute("UseDocumentTabs", static_cast<int>(appPrefs.uiPrefs.useTabs));
 	dcUI.setAttribute("StickyTools", static_cast<int>(appPrefs.uiPrefs.stickyTools));
 	dcUI.setAttribute("Theme", appPrefs.uiPrefs.style);
+	dcUI.setAttribute("ThemePalette", appPrefs.uiPrefs.stylePalette);
 	dcUI.setAttribute("ScrollWheelJump", appPrefs.uiPrefs.wheelJump);
 	dcUI.setAttribute("MouseMoveTimeout", appPrefs.uiPrefs.mouseMoveTimeout);
 	dcUI.setAttribute("ApplicationFontSize", appPrefs.uiPrefs.applicationFontSize);
@@ -2038,6 +2045,7 @@
 		if (dc.tagName() == "UI")
 		{
 			appPrefs.uiPrefs.style = dc.attribute("Theme", "Default");
+			appPrefs.uiPrefs.stylePalette = dc.attribute("ThemePalette", "auto");
 			appPrefs.uiPrefs.wheelJump = dc.attribute("ScrollWheelJump").toInt();
 			appPrefs.uiPrefs.mouseMoveTimeout = dc.attribute("MouseMoveTimeout", "150").toInt();
 			appPrefs.uiPrefs.applicationFontSize = dc.attribute("ApplicationFontSize", "12").toInt();
Index: scribus/prefsmanager.h
===================================================================
--- scribus/prefsmanager.h	(Revision 26725)
+++ scribus/prefsmanager.h	(Arbeitskopie)
@@ -145,6 +145,7 @@
 	const QString& uiLanguage() const;
 	//! \brief Get the GUI style from preferences
 	const QString& guiStyle() const;
+	const QString& guiStylePalette() const;
 	const QString& guiSystemStyle() const;
 	//! \brief Get the GUI icon set from preferences
 	const QString& guiIconSet() const;
Index: scribus/prefsstructs.h
===================================================================
--- scribus/prefsstructs.h	(Revision 26725)
+++ scribus/prefsstructs.h	(Arbeitskopie)
@@ -119,6 +119,7 @@
 	int applicationFontSize {12}; //! Font size to use in the application, apart from pßalettes
 	int paletteFontSize {10}; //! Font size to use in the palettes
 	QString style; 	//! Currently used QStyle name
+	QString stylePalette; //! UI theme palette, dark, light, auto
 	int recentDocCount {5}; //! Number of recent documents to remember
 	QStringList RecentDocs; //! List of recent documents
 	QString language; //! Language of the user interface
Index: scribus/scribuscore.cpp
===================================================================
--- scribus/scribuscore.cpp	(Revision 26725)
+++ scribus/scribuscore.cpp	(Arbeitskopie)
@@ -30,6 +30,7 @@
 #include <QMessageBox>
 #include <QScreen>
 #include <QStyleFactory>
+#include <QStyleHints>
 
 #include "colormgmt/sccolormgmtenginefactory.h"
 #include "commonstrings.h"
@@ -175,6 +176,34 @@
 	setSplashStatus( tr("Reading Preferences") );
 	m_prefsManager.readPrefs();
 
+	// This is a very basic implemenation of the UI theme palette.
+	// If necessary implement platform specific theme configurations here.
+
+	// Apply different palette only if the system UI palette is different.
+	if (m_prefsManager.appPrefs.uiPrefs.stylePalette == "dark" && ScQApp->styleHints()->colorScheme() == Qt::ColorScheme::Light)
+	{
+		QPalette pal(QColor(49, 49, 49));
+		ScQApp->setPalette(pal);
+	}
+	else if (m_prefsManager.appPrefs.uiPrefs.stylePalette == "light" && ScQApp->styleHints()->colorScheme() == Qt::ColorScheme::Dark)
+	{
+		QPalette pal(QColor(239, 239, 239));
+		ScQApp->setPalette(pal);
+	}
+#if (defined Q_OS_LINUX && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
+	else
+	{
+		// As long as this bug persists, we have to repair the palette ourselves
+		// https://bugreports.qt.io/browse/QTBUG-126208
+		// See color values of fusion palette here: https://github.com/qt/qtbase/blob/dev/src/gui/kernel/qplatformtheme.cpp#L356
+		if (ScQApp->styleHints()->colorScheme() == Qt::ColorScheme::Light && ScQApp->style()->name() == "fusion")
+		{
+			QPalette pal(QColor(239, 239, 239));
+			ScQApp->setPalette(pal);
+		}
+	}
+#endif
+
 	// Configure GUI
 	const QString& prefsUiStyle = m_prefsManager.appPrefs.uiPrefs.style;
 	if (prefsUiStyle.length() > 0)
Index: scribus/ui/prefs_userinterface.cpp
===================================================================
--- scribus/ui/prefs_userinterface.cpp	(Revision 26725)
+++ scribus/ui/prefs_userinterface.cpp	(Arbeitskopie)
@@ -59,6 +59,12 @@
 
 void Prefs_UserInterface::languageChange()
 {
+	themePaletteComboBox->clear();
+	themePaletteComboBox->addItem(tr("Auto"), "auto");
+	themePaletteComboBox->addItem(tr("Light"), "light");
+	themePaletteComboBox->addItem(tr("Dark"), "dark");
+	themePaletteComboBox->setToolTip( "<qt>" + tr( "Choose the default theme palette. Auto uses the systems default." ) + "</qt>");
+
 	themeComboBox->setToolTip( "<qt>" + tr( "Choose the default window decoration and looks. Scribus inherits any available KDE or Qt themes, if Qt is configured to search KDE plugins." ) + "</qt>");
 	iconSetComboBox->setToolTip( "<qt>" + tr( "Choose the default icon set" ) + "</qt>");
 	useSmallWidgetsCheckBox->setToolTip( "<qt>" + tr( "Palette windows will use smaller (space savvy) widgets. Requires application restart." ) + "</qt>");
@@ -92,6 +98,13 @@
 		selectedGUILang = "en_GB";
 		langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
 	}
+
+	int index = themePaletteComboBox->findData(prefsData->uiPrefs.stylePalette);
+	if ( index != -1 )
+		themePaletteComboBox->setCurrentIndex(index);
+	else
+		themePaletteComboBox->setCurrentIndex(0);
+
 	setCurrentComboItem(languageComboBox, langString);
 	numberFormatComboBox->setCurrentIndex(prefsData->uiPrefs.userPreferredLocale == "System" ? 0 : 1);
 	setCurrentComboItem(themeComboBox, prefsData->uiPrefs.style);
@@ -118,6 +131,7 @@
 	prefsData->uiPrefs.language = selectedGUILang;
 	prefsData->uiPrefs.userPreferredLocale = numberFormatComboBox->currentData().toString();
 	prefsData->uiPrefs.style = themeComboBox->currentText();
+	prefsData->uiPrefs.stylePalette = themePaletteComboBox->currentData().toString();
 	prefsData->uiPrefs.iconSet = IconManager::instance().baseNameForTranslation(iconSetComboBox->currentText());
 	prefsData->uiPrefs.applicationFontSize = fontSizeMenuSpinBox->value();
 	prefsData->uiPrefs.paletteFontSize = fontSizePaletteSpinBox->value();
Index: scribus/ui/prefs_userinterfacebase.ui
===================================================================
--- scribus/ui/prefs_userinterfacebase.ui	(Revision 26725)
+++ scribus/ui/prefs_userinterfacebase.ui	(Arbeitskopie)
@@ -39,7 +39,7 @@
    <item>
     <widget class="Line" name="line">
      <property name="orientation">
-      <enum>Qt::Horizontal</enum>
+      <enum>Qt::Orientation::Horizontal</enum>
      </property>
     </widget>
    </item>
@@ -68,7 +68,7 @@
        <item>
         <widget class="Line" name="line_3">
          <property name="orientation">
-          <enum>Qt::Horizontal</enum>
+          <enum>Qt::Orientation::Horizontal</enum>
          </property>
         </widget>
        </item>
@@ -75,7 +75,7 @@
        <item>
         <layout class="QFormLayout" name="formLayout">
          <property name="fieldGrowthPolicy">
-          <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+          <enum>QFormLayout::FieldGrowthPolicy::FieldsStayAtSizeHint</enum>
          </property>
          <item row="0" column="0">
           <widget class="QLabel" name="themeLabel">
@@ -90,7 +90,7 @@
          <item row="0" column="1">
           <widget class="QComboBox" name="themeComboBox"/>
          </item>
-         <item row="1" column="0">
+         <item row="2" column="0">
           <widget class="QLabel" name="label_3">
            <property name="text">
             <string>Icon Set:</string>
@@ -97,10 +97,10 @@
            </property>
           </widget>
          </item>
-         <item row="1" column="1">
+         <item row="2" column="1">
           <widget class="QComboBox" name="iconSetComboBox"/>
          </item>
-         <item row="2" column="1">
+         <item row="3" column="1">
           <widget class="QCheckBox" name="useSmallWidgetsCheckBox">
            <property name="text">
             <string>Use Small Widgets on Palettes</string>
@@ -107,7 +107,7 @@
            </property>
           </widget>
          </item>
-         <item row="5" column="1">
+         <item row="6" column="1">
           <widget class="QCheckBox" name="useTabsForDocumentsCheckBox">
            <property name="text">
             <string>Use Tabs for Documents</string>
@@ -114,7 +114,7 @@
            </property>
           </widget>
          </item>
-         <item row="6" column="0">
+         <item row="7" column="0">
           <widget class="QLabel" name="recentDocumentsLabel">
            <property name="text">
             <string>&amp;Recent Documents:</string>
@@ -124,10 +124,10 @@
            </property>
           </widget>
          </item>
-         <item row="6" column="1">
+         <item row="7" column="1">
           <widget class="QSpinBox" name="recentDocumentsSpinBox"/>
          </item>
-         <item row="3" column="1">
+         <item row="4" column="1">
           <widget class="QCheckBox" name="showLabels">
            <property name="text">
             <string>Show Informational Labels</string>
@@ -134,7 +134,7 @@
            </property>
           </widget>
          </item>
-         <item row="4" column="1">
+         <item row="5" column="1">
           <widget class="QCheckBox" name="showLabelsOfInactiveTabs">
            <property name="text">
             <string>Show Labels of Inactive Palette Tabs</string>
@@ -141,15 +141,25 @@
            </property>
           </widget>
          </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="themePaletteLabel">
+           <property name="text">
+            <string>Color Palette:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QComboBox" name="themePaletteComboBox"/>
+         </item>
         </layout>
        </item>
        <item>
         <spacer name="verticalSpacer_6">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
+          <enum>QSizePolicy::Policy::Fixed</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -174,7 +184,7 @@
        <item>
         <widget class="Line" name="line_4">
          <property name="orientation">
-          <enum>Qt::Horizontal</enum>
+          <enum>Qt::Orientation::Horizontal</enum>
          </property>
         </widget>
        </item>
@@ -211,10 +221,10 @@
        <item>
         <spacer name="verticalSpacer_4">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
+          <enum>QSizePolicy::Policy::Fixed</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -239,7 +249,7 @@
        <item>
         <widget class="Line" name="line_2">
          <property name="orientation">
-          <enum>Qt::Horizontal</enum>
+          <enum>Qt::Orientation::Horizontal</enum>
          </property>
         </widget>
        </item>
@@ -284,7 +294,7 @@
        <item>
         <spacer name="verticalSpacer_3">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -304,7 +314,7 @@
        <item>
         <layout class="QFormLayout" name="formLayout_3">
          <property name="fieldGrowthPolicy">
-          <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+          <enum>QFormLayout::FieldGrowthPolicy::FieldsStayAtSizeHint</enum>
          </property>
          <item row="0" column="0">
           <widget class="QLabel" name="storyEditorFontLabel">
@@ -332,7 +342,7 @@
        <item>
         <spacer name="verticalSpacer_5">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -352,7 +362,7 @@
        <item>
         <layout class="QFormLayout" name="formLayout_4">
          <property name="fieldGrowthPolicy">
-          <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+          <enum>QFormLayout::FieldGrowthPolicy::FieldsStayAtSizeHint</enum>
          </property>
          <item row="0" column="0">
           <widget class="QLabel" name="resizeMoveDelayLabel">
@@ -392,7 +402,7 @@
        <item>
         <spacer name="verticalSpacer_2">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -430,7 +440,7 @@
        <item>
         <spacer name="verticalSpacer">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
uitheme_2025-02-24_01.patch (14,451 bytes)   

nitramr

2025-02-24 22:46

developer   ~0052117

One issue I noticed. The splash screen is initialized before the color scheme is read from prefs file. So, the splash screen shows the image variant based on the operating system color scheme.

nitramr

2025-02-25 22:02

developer   ~0052123

Seems like that qt 6.8.0 has a new function to set the color scheme and force the dark theme on a light system ui.
https://doc.qt.io/qt-6/qstylehints.html#setColorScheme

I made some more changes:
- the splash screen should change the image variant as soon as a new color scheme is loaded
- the dark/light theme should be applied as soon as the user click on save button of preferences dialog

Unfortunately, I could not test the implementation because the setColorScheme() function is not implemented for Linux systems. See https://bugreports.qt.io/browse/QTBUG-132929
So the above-mentioned changes will not work for Linux at all. The user have to restart Scribus to apply the changes.

The patch requires Qt 6.8+
uitheme_2025-02-25_01.patch (15,789 bytes)   
Index: scribus/iconmanager.cpp
===================================================================
--- scribus/iconmanager.cpp	(Revision 26725)
+++ scribus/iconmanager.cpp	(Arbeitskopie)
@@ -135,16 +135,12 @@
 bool IconManager::iconsForDarkMode() const
 {	
 #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
-	switch(qApp->styleHints()->colorScheme())
-	{
-	case Qt::ColorScheme::Unknown:
-	case Qt::ColorScheme::Light:
+	if (qApp->styleHints()->colorScheme() == Qt::ColorScheme::Light)
 		return false;
-	case Qt::ColorScheme::Dark:
+	else if (qApp->styleHints()->colorScheme() == Qt::ColorScheme::Dark)
 		return true;
-	default:
-		return false;
-	}
+	else
+		return (baseColor().lightness() >= 128) ? true : false;
 #else
 	return (baseColor().lightness() >= 128) ? true : false;
 #endif
Index: scribus/iconmanager.h
===================================================================
--- scribus/iconmanager.h	(Revision 26725)
+++ scribus/iconmanager.h	(Arbeitskopie)
@@ -43,7 +43,6 @@
 	void operator=(IconManager const&) = delete;
 	static IconManager& instance();
 
-	void setIconsForDarkMode(bool forDarkMode);
 	QColor baseColor() const;
 	bool iconsForDarkMode() const;
 	bool setup();
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(Revision 26725)
+++ scribus/prefsmanager.cpp	(Arbeitskopie)
@@ -157,6 +157,7 @@
 	appPrefs.uiPrefs.mouseMoveTimeout = 150;
 	appPrefs.uiPrefs.wheelJump = 40;
 	appPrefs.uiPrefs.style = "";
+	appPrefs.uiPrefs.stylePalette = "auto";
 	// On Windows, use the Fusion theme by default when possible,
 	// the old Windows and windowsvista style do not support dark theme
 #if defined Q_OS_WINDOWS
@@ -1360,6 +1361,7 @@
 	dcUI.setAttribute("UseDocumentTabs", static_cast<int>(appPrefs.uiPrefs.useTabs));
 	dcUI.setAttribute("StickyTools", static_cast<int>(appPrefs.uiPrefs.stickyTools));
 	dcUI.setAttribute("Theme", appPrefs.uiPrefs.style);
+	dcUI.setAttribute("ThemePalette", appPrefs.uiPrefs.stylePalette);
 	dcUI.setAttribute("ScrollWheelJump", appPrefs.uiPrefs.wheelJump);
 	dcUI.setAttribute("MouseMoveTimeout", appPrefs.uiPrefs.mouseMoveTimeout);
 	dcUI.setAttribute("ApplicationFontSize", appPrefs.uiPrefs.applicationFontSize);
@@ -2038,6 +2040,7 @@
 		if (dc.tagName() == "UI")
 		{
 			appPrefs.uiPrefs.style = dc.attribute("Theme", "Default");
+			appPrefs.uiPrefs.stylePalette = dc.attribute("ThemePalette", "auto");
 			appPrefs.uiPrefs.wheelJump = dc.attribute("ScrollWheelJump").toInt();
 			appPrefs.uiPrefs.mouseMoveTimeout = dc.attribute("MouseMoveTimeout", "150").toInt();
 			appPrefs.uiPrefs.applicationFontSize = dc.attribute("ApplicationFontSize", "12").toInt();
Index: scribus/prefsstructs.h
===================================================================
--- scribus/prefsstructs.h	(Revision 26725)
+++ scribus/prefsstructs.h	(Arbeitskopie)
@@ -119,6 +119,7 @@
 	int applicationFontSize {12}; //! Font size to use in the application, apart from pßalettes
 	int paletteFontSize {10}; //! Font size to use in the palettes
 	QString style; 	//! Currently used QStyle name
+	QString stylePalette; //! UI theme palette, dark, light, auto
 	int recentDocCount {5}; //! Number of recent documents to remember
 	QStringList RecentDocs; //! List of recent documents
 	QString language; //! Language of the user interface
Index: scribus/scribuscore.cpp
===================================================================
--- scribus/scribuscore.cpp	(Revision 26725)
+++ scribus/scribuscore.cpp	(Arbeitskopie)
@@ -30,6 +30,7 @@
 #include <QMessageBox>
 #include <QScreen>
 #include <QStyleFactory>
+#include <QStyleHints>
 
 #include "colormgmt/sccolormgmtenginefactory.h"
 #include "commonstrings.h"
@@ -175,6 +176,51 @@
 	setSplashStatus( tr("Reading Preferences") );
 	m_prefsManager.readPrefs();
 
+	// This is a very basic implemenation of the UI theme palette.
+	// If necessary implement platform specific theme configurations here.
+
+	// Apply different palette only if the system UI palette is different.
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
+	if (m_prefsManager.appPrefs.uiPrefs.stylePalette == "dark" && QApplication::styleHints()->colorScheme() == Qt::ColorScheme::Light)
+	{
+		QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Dark);
+
+// https://bugreports.qt.io/browse/QTBUG-132929
+#if (defined Q_OS_LINUX)
+		QPalette pal(QColor(49, 49, 49));
+		QApplication::setPalette(pal);
+#endif
+		m_SplashScreen->setPixmap(IconManager::instance().splashScreen());
+	}
+	else if (m_prefsManager.appPrefs.uiPrefs.stylePalette == "light" && QApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark)
+	{
+		QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Light);
+
+		// https://bugreports.qt.io/browse/QTBUG-132929
+#if (defined Q_OS_LINUX)
+		QPalette pal(QColor(239, 239, 239));
+		QApplication::setPalette(pal);
+#endif
+		m_SplashScreen->setPixmap(IconManager::instance().splashScreen());
+	}
+	else
+	{
+		QApplication::styleHints()->unsetColorScheme();
+
+#if (defined Q_OS_LINUX)
+		// As long as this bug persists, we have to repair the palette ourselves
+		// https://bugreports.qt.io/browse/QTBUG-126208
+		// See color values of fusion palette here: https://github.com/qt/qtbase/blob/dev/src/gui/kernel/qplatformtheme.cpp#L356
+		if (QApplication::styleHints()->colorScheme() == Qt::ColorScheme::Light && QApplication::style()->name() == "fusion")
+		{
+			QPalette pal(QColor(239, 239, 239));
+			QApplication::setPalette(pal);
+		}
+#endif
+	}
+#endif
+
+
 	// Configure GUI
 	const QString& prefsUiStyle = m_prefsManager.appPrefs.uiPrefs.style;
 	if (prefsUiStyle.length() > 0)
Index: scribus/ui/prefs_userinterface.cpp
===================================================================
--- scribus/ui/prefs_userinterface.cpp	(Revision 26725)
+++ scribus/ui/prefs_userinterface.cpp	(Arbeitskopie)
@@ -9,6 +9,7 @@
 #include <QFontDialog>
 #include <QPixmap>
 #include <QStyleFactory>
+#include <QStyleHints>
 
 #include "iconmanager.h"
 #include "langmgr.h"
@@ -59,6 +60,12 @@
 
 void Prefs_UserInterface::languageChange()
 {
+	themePaletteComboBox->clear();
+	themePaletteComboBox->addItem(tr("Auto"), "auto");
+	themePaletteComboBox->addItem(tr("Light"), "light");
+	themePaletteComboBox->addItem(tr("Dark"), "dark");
+	themePaletteComboBox->setToolTip( "<qt>" + tr( "Choose the default theme palette. Auto uses the systems default." ) + "</qt>");
+
 	themeComboBox->setToolTip( "<qt>" + tr( "Choose the default window decoration and looks. Scribus inherits any available KDE or Qt themes, if Qt is configured to search KDE plugins." ) + "</qt>");
 	iconSetComboBox->setToolTip( "<qt>" + tr( "Choose the default icon set" ) + "</qt>");
 	useSmallWidgetsCheckBox->setToolTip( "<qt>" + tr( "Palette windows will use smaller (space savvy) widgets. Requires application restart." ) + "</qt>");
@@ -92,6 +99,13 @@
 		selectedGUILang = "en_GB";
 		langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
 	}
+
+	int index = themePaletteComboBox->findData(prefsData->uiPrefs.stylePalette);
+	if ( index != -1 )
+		themePaletteComboBox->setCurrentIndex(index);
+	else
+		themePaletteComboBox->setCurrentIndex(0);
+
 	setCurrentComboItem(languageComboBox, langString);
 	numberFormatComboBox->setCurrentIndex(prefsData->uiPrefs.userPreferredLocale == "System" ? 0 : 1);
 	setCurrentComboItem(themeComboBox, prefsData->uiPrefs.style);
@@ -118,6 +132,7 @@
 	prefsData->uiPrefs.language = selectedGUILang;
 	prefsData->uiPrefs.userPreferredLocale = numberFormatComboBox->currentData().toString();
 	prefsData->uiPrefs.style = themeComboBox->currentText();
+	prefsData->uiPrefs.stylePalette = themePaletteComboBox->currentData().toString();
 	prefsData->uiPrefs.iconSet = IconManager::instance().baseNameForTranslation(iconSetComboBox->currentText());
 	prefsData->uiPrefs.applicationFontSize = fontSizeMenuSpinBox->value();
 	prefsData->uiPrefs.paletteFontSize = fontSizePaletteSpinBox->value();
@@ -133,6 +148,16 @@
 
 	prefsData->storyEditorPrefs.guiFont = seFont.toString();
 	prefsData->storyEditorPrefs.smartTextSelection = storyEditorUseSmartSelectionCheckBox->isChecked();
+
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
+	if (prefsData->uiPrefs.stylePalette == "dark")
+		QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Dark);
+	else if (prefsData->uiPrefs.stylePalette == "light")
+		QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Light);
+	else
+		QApplication::styleHints()->unsetColorScheme();
+#endif
+
 }
 
 void Prefs_UserInterface::setSelectedGUILang(const QString &newLang)
Index: scribus/ui/prefs_userinterfacebase.ui
===================================================================
--- scribus/ui/prefs_userinterfacebase.ui	(Revision 26725)
+++ scribus/ui/prefs_userinterfacebase.ui	(Arbeitskopie)
@@ -39,7 +39,7 @@
    <item>
     <widget class="Line" name="line">
      <property name="orientation">
-      <enum>Qt::Horizontal</enum>
+      <enum>Qt::Orientation::Horizontal</enum>
      </property>
     </widget>
    </item>
@@ -68,7 +68,7 @@
        <item>
         <widget class="Line" name="line_3">
          <property name="orientation">
-          <enum>Qt::Horizontal</enum>
+          <enum>Qt::Orientation::Horizontal</enum>
          </property>
         </widget>
        </item>
@@ -75,7 +75,7 @@
        <item>
         <layout class="QFormLayout" name="formLayout">
          <property name="fieldGrowthPolicy">
-          <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+          <enum>QFormLayout::FieldGrowthPolicy::FieldsStayAtSizeHint</enum>
          </property>
          <item row="0" column="0">
           <widget class="QLabel" name="themeLabel">
@@ -90,7 +90,7 @@
          <item row="0" column="1">
           <widget class="QComboBox" name="themeComboBox"/>
          </item>
-         <item row="1" column="0">
+         <item row="2" column="0">
           <widget class="QLabel" name="label_3">
            <property name="text">
             <string>Icon Set:</string>
@@ -97,10 +97,10 @@
            </property>
           </widget>
          </item>
-         <item row="1" column="1">
+         <item row="2" column="1">
           <widget class="QComboBox" name="iconSetComboBox"/>
          </item>
-         <item row="2" column="1">
+         <item row="3" column="1">
           <widget class="QCheckBox" name="useSmallWidgetsCheckBox">
            <property name="text">
             <string>Use Small Widgets on Palettes</string>
@@ -107,7 +107,7 @@
            </property>
           </widget>
          </item>
-         <item row="5" column="1">
+         <item row="6" column="1">
           <widget class="QCheckBox" name="useTabsForDocumentsCheckBox">
            <property name="text">
             <string>Use Tabs for Documents</string>
@@ -114,7 +114,7 @@
            </property>
           </widget>
          </item>
-         <item row="6" column="0">
+         <item row="7" column="0">
           <widget class="QLabel" name="recentDocumentsLabel">
            <property name="text">
             <string>&amp;Recent Documents:</string>
@@ -124,10 +124,10 @@
            </property>
           </widget>
          </item>
-         <item row="6" column="1">
+         <item row="7" column="1">
           <widget class="QSpinBox" name="recentDocumentsSpinBox"/>
          </item>
-         <item row="3" column="1">
+         <item row="4" column="1">
           <widget class="QCheckBox" name="showLabels">
            <property name="text">
             <string>Show Informational Labels</string>
@@ -134,7 +134,7 @@
            </property>
           </widget>
          </item>
-         <item row="4" column="1">
+         <item row="5" column="1">
           <widget class="QCheckBox" name="showLabelsOfInactiveTabs">
            <property name="text">
             <string>Show Labels of Inactive Palette Tabs</string>
@@ -141,15 +141,25 @@
            </property>
           </widget>
          </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="themePaletteLabel">
+           <property name="text">
+            <string>Color Palette:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QComboBox" name="themePaletteComboBox"/>
+         </item>
         </layout>
        </item>
        <item>
         <spacer name="verticalSpacer_6">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
+          <enum>QSizePolicy::Policy::Fixed</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -174,7 +184,7 @@
        <item>
         <widget class="Line" name="line_4">
          <property name="orientation">
-          <enum>Qt::Horizontal</enum>
+          <enum>Qt::Orientation::Horizontal</enum>
          </property>
         </widget>
        </item>
@@ -211,10 +221,10 @@
        <item>
         <spacer name="verticalSpacer_4">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
+          <enum>QSizePolicy::Policy::Fixed</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -239,7 +249,7 @@
        <item>
         <widget class="Line" name="line_2">
          <property name="orientation">
-          <enum>Qt::Horizontal</enum>
+          <enum>Qt::Orientation::Horizontal</enum>
          </property>
         </widget>
        </item>
@@ -284,7 +294,7 @@
        <item>
         <spacer name="verticalSpacer_3">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -304,7 +314,7 @@
        <item>
         <layout class="QFormLayout" name="formLayout_3">
          <property name="fieldGrowthPolicy">
-          <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+          <enum>QFormLayout::FieldGrowthPolicy::FieldsStayAtSizeHint</enum>
          </property>
          <item row="0" column="0">
           <widget class="QLabel" name="storyEditorFontLabel">
@@ -332,7 +342,7 @@
        <item>
         <spacer name="verticalSpacer_5">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -352,7 +362,7 @@
        <item>
         <layout class="QFormLayout" name="formLayout_4">
          <property name="fieldGrowthPolicy">
-          <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+          <enum>QFormLayout::FieldGrowthPolicy::FieldsStayAtSizeHint</enum>
          </property>
          <item row="0" column="0">
           <widget class="QLabel" name="resizeMoveDelayLabel">
@@ -392,7 +402,7 @@
        <item>
         <spacer name="verticalSpacer_2">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -430,7 +440,7 @@
        <item>
         <spacer name="verticalSpacer">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
uitheme_2025-02-25_01.patch (15,789 bytes)   

cbradney

2025-02-26 19:18

administrator   ~0052124

The UI does not completely switch from a change when you leave Preferences. Do you think this is possible? It looks like QtADS is missing something from the change?
image.png (384,192 bytes)   
image.png (384,192 bytes)   

nitramr

2025-02-26 19:24

developer   ~0052125

Thanks for the test. I will make more tests too. Even the icons are not changed too. The iconmanager should rebuild the icon cache as soon as the colorSchemeChanged signal is fired from QApplication.

nitramr

2025-02-26 22:04

developer   ~0052128

Ok, next try!

I think I fixed all the issues. When you save the settings and changed the appearance, the UI style and icons will also update. This should fix the inconsistent UI color.
Also, I made a slightly different implementation for loading the splash screen pixmap. With this change, it is possible to reload the splash screen pixmap once the UI appearance has changed.
uitheme_2025-02-26_01.patch (20,256 bytes)   
Index: scribus/iconmanager.cpp
===================================================================
--- scribus/iconmanager.cpp	(Revision 26726)
+++ scribus/iconmanager.cpp	(Arbeitskopie)
@@ -36,8 +36,6 @@
 	: QObject(parent)
 {
 	m_splashScreenRect = QRect();
-	m_splashScreen = QPixmap();
-
 }
 
 IconManager& IconManager::instance()
@@ -64,7 +62,7 @@
 	}
 
 #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
-	connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, &IconManager::changeColorScheme);
+	connect(qApp->styleHints(), &QStyleHints::colorSchemeChanged, this, &IconManager::changeColorScheme);
 #endif
 
 	return true;
@@ -134,20 +132,18 @@
 
 bool IconManager::iconsForDarkMode() const
 {	
-#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
-	switch(qApp->styleHints()->colorScheme())
-	{
-	case Qt::ColorScheme::Unknown:
-	case Qt::ColorScheme::Light:
-		return false;
-	case Qt::ColorScheme::Dark:
-		return true;
-	default:
-		return false;
-	}
-#else
+// #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+// 	if (qApp->styleHints()->colorScheme() == Qt::ColorScheme::Light)
+// 		return false;
+// 	else if (qApp->styleHints()->colorScheme() == Qt::ColorScheme::Dark)
+// 		return true;
+// 	else
+// 		return (baseColor().lightness() >= 128) ? true : false;
+// #else
+// 	return (baseColor().lightness() >= 128) ? true : false;
+// #endif
+
 	return (baseColor().lightness() >= 128) ? true : false;
-#endif
 }
 
 void IconManager::rebuildCache()
@@ -608,10 +604,8 @@
 					w = (e.hasAttribute("width")) ? e.attribute("width").toInt() : 0;
 					h = (e.hasAttribute("height")) ? e.attribute("height").toInt() : 0;
 					isd.splashMessgeRect = QRect(l,t,w,h);
-					if (iconsForDarkMode())
-						isd.splashScreenPath = (e.hasAttribute("imageDark")) ? e.attribute("imageDark") : "";
-					else
-						isd.splashScreenPath = (e.hasAttribute("imageLight")) ? e.attribute("imageLight") : "";
+					isd.splashScreenDarkPath = (e.hasAttribute("imageDark")) ? e.attribute("imageDark") : "";
+					isd.splashScreenLightPath = (e.hasAttribute("imageLight")) ? e.attribute("imageLight") : "";
 
 				}
 				else if (e.tagName() == "nametext")
@@ -663,7 +657,6 @@
 				m_activeSetBasename = isd.baseName;
 				m_activeSetVersion = isd.activeversion;
 				m_splashScreenRect = isd.splashMessgeRect;
-				m_splashScreen = QPixmap(pathForIcon(isd.splashScreenPath));
 			}
 		}
 	}
@@ -677,13 +670,12 @@
 	m_activeSetBasename = m_iconSets[prefsSet].baseName;
 	m_activeSetVersion = m_iconSets[prefsSet].activeversion;
 	m_splashScreenRect = m_iconSets[prefsSet].splashMessgeRect;
-	m_splashScreen = QPixmap(pathForIcon(m_iconSets[prefsSet].splashScreenPath));
 
 	rebuildCache();
 	return true;
 }
 
-QString IconManager::pathForIcon(const QString& name)
+QString IconManager::pathForIcon(const QString &name) const
 {
 	//QString iconset(PrefsManager::instance().appPrefs.uiPrefs.iconSet);
 	QString iconSubdir(m_iconSets[m_activeSetBasename].path + "/");
@@ -746,5 +738,8 @@
 
 QPixmap IconManager::splashScreen() const
 {
-	return m_splashScreen;
+	if (iconsForDarkMode())
+		return QPixmap(pathForIcon(m_iconSets[m_activeSetBasename].splashScreenDarkPath));
+	else
+		return QPixmap(pathForIcon(m_iconSets[m_activeSetBasename].splashScreenLightPath));
 }
Index: scribus/iconmanager.h
===================================================================
--- scribus/iconmanager.h	(Revision 26726)
+++ scribus/iconmanager.h	(Arbeitskopie)
@@ -43,7 +43,6 @@
 	void operator=(IconManager const&) = delete;
 	static IconManager& instance();
 
-	void setIconsForDarkMode(bool forDarkMode);
 	QColor baseColor() const;
 	bool iconsForDarkMode() const;
 	bool setup();
@@ -60,7 +59,7 @@
 
 	bool setActiveFromPrefs(const QString& prefsSet);
 	QString activeSetBasename() { return m_activeSetBasename; }
-	QString pathForIcon(const QString& name);
+	QString pathForIcon(const QString& name) const;
 	QString baseNameForTranslation(const QString& transName) const;
 	QStringList nameList(const QString& language) const;
 
@@ -95,7 +94,6 @@
 	QString m_backupSetBasename;
 	QString m_backupSetVersion;
 	QRect m_splashScreenRect;
-	QPixmap m_splashScreen;
 	qreal m_devicePixelRatio { 1.0 };
 
 	bool initIconSets();
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(Revision 26726)
+++ scribus/prefsmanager.cpp	(Arbeitskopie)
@@ -157,6 +157,7 @@
 	appPrefs.uiPrefs.mouseMoveTimeout = 150;
 	appPrefs.uiPrefs.wheelJump = 40;
 	appPrefs.uiPrefs.style = "";
+	appPrefs.uiPrefs.stylePalette = "auto";
 	// On Windows, use the Fusion theme by default when possible,
 	// the old Windows and windowsvista style do not support dark theme
 #if defined Q_OS_WINDOWS
@@ -1360,6 +1361,7 @@
 	dcUI.setAttribute("UseDocumentTabs", static_cast<int>(appPrefs.uiPrefs.useTabs));
 	dcUI.setAttribute("StickyTools", static_cast<int>(appPrefs.uiPrefs.stickyTools));
 	dcUI.setAttribute("Theme", appPrefs.uiPrefs.style);
+	dcUI.setAttribute("ThemePalette", appPrefs.uiPrefs.stylePalette);
 	dcUI.setAttribute("ScrollWheelJump", appPrefs.uiPrefs.wheelJump);
 	dcUI.setAttribute("MouseMoveTimeout", appPrefs.uiPrefs.mouseMoveTimeout);
 	dcUI.setAttribute("ApplicationFontSize", appPrefs.uiPrefs.applicationFontSize);
@@ -2038,6 +2040,7 @@
 		if (dc.tagName() == "UI")
 		{
 			appPrefs.uiPrefs.style = dc.attribute("Theme", "Default");
+			appPrefs.uiPrefs.stylePalette = dc.attribute("ThemePalette", "auto");
 			appPrefs.uiPrefs.wheelJump = dc.attribute("ScrollWheelJump").toInt();
 			appPrefs.uiPrefs.mouseMoveTimeout = dc.attribute("MouseMoveTimeout", "150").toInt();
 			appPrefs.uiPrefs.applicationFontSize = dc.attribute("ApplicationFontSize", "12").toInt();
Index: scribus/prefsstructs.h
===================================================================
--- scribus/prefsstructs.h	(Revision 26726)
+++ scribus/prefsstructs.h	(Arbeitskopie)
@@ -119,6 +119,7 @@
 	int applicationFontSize {12}; //! Font size to use in the application, apart from pßalettes
 	int paletteFontSize {10}; //! Font size to use in the palettes
 	QString style; 	//! Currently used QStyle name
+	QString stylePalette; //! UI theme palette, dark, light, auto
 	int recentDocCount {5}; //! Number of recent documents to remember
 	QStringList RecentDocs; //! List of recent documents
 	QString language; //! Language of the user interface
@@ -539,7 +540,8 @@
 	QString variant;
 	bool isDefault;
 	QRect splashMessgeRect;
-	QString splashScreenPath;
+	QString splashScreenLightPath;
+	QString splashScreenDarkPath;
 	QMap<QString, QString> nameTranslations;
 };
 
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(Revision 26726)
+++ scribus/scribus.cpp	(Arbeitskopie)
@@ -6496,9 +6441,44 @@
 	m_prefsManager.appPrefs.uiPrefs.language = ScQApp->currGUILanguage();
 	LocaleManager::instance().setUserPreferredLocale(m_prefsManager.appPrefs.uiPrefs.userPreferredLocale);
 	ScQApp->setLocale();
+
+	bool forceStyleUpdate = false;
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
+	QString newUIStylePalette = m_prefsManager.appPrefs.uiPrefs.stylePalette;
+	if (oldPrefs.uiPrefs.stylePalette != newUIStylePalette)
+	{
+		forceStyleUpdate = true;
+
+		if (newUIStylePalette == "dark")
+		{
+			QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Dark);
+#if (defined Q_OS_LINUX)
+			QPalette pal(QColor(49, 49, 49));
+			QApplication::setPalette(pal);
+#endif
+		}
+		else if (newUIStylePalette == "light")
+		{
+			QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Light);
+#if (defined Q_OS_LINUX)
+			QPalette pal(QColor(239, 239, 239));
+			QApplication::setPalette(pal);
+#endif
+		}
+		else
+		{
+			QApplication::styleHints()->unsetColorScheme();
+			QApplication::setPalette(this->style()->standardPalette());
+		}
+	}
+#endif
+
+	bool forceIconUpdate = false;
 	QString newUIStyle = m_prefsManager.guiStyle();
-	if (oldPrefs.uiPrefs.style != newUIStyle)
+	if (oldPrefs.uiPrefs.style != newUIStyle || forceStyleUpdate == true)
 	{
+		forceIconUpdate = true;
+
 		QString styleName = m_prefsManager.guiSystemStyle();
 		if (!newUIStyle.isEmpty())
 			styleName = newUIStyle;
@@ -6511,7 +6491,7 @@
 
 	QString newIconSet = m_prefsManager.guiIconSet();
 	// Recreate icons if icon set or GUI changed. For GUI change the icon recreation will automatically detect light and dark themes
-	if (oldPrefs.uiPrefs.iconSet != newIconSet || oldPrefs.uiPrefs.style != newUIStyle)
+	if (oldPrefs.uiPrefs.iconSet != newIconSet || forceIconUpdate == true)
 		ScQApp->changeIconSet(newIconSet);
 
 	ScQApp->changeLabelVisibility(m_prefsManager.appPrefs.uiPrefs.showLabels);
Index: scribus/scribuscore.cpp
===================================================================
--- scribus/scribuscore.cpp	(Revision 26726)
+++ scribus/scribuscore.cpp	(Arbeitskopie)
@@ -30,6 +30,7 @@
 #include <QMessageBox>
 #include <QScreen>
 #include <QStyleFactory>
+#include <QStyleHints>
 
 #include "colormgmt/sccolormgmtenginefactory.h"
 #include "commonstrings.h"
@@ -175,6 +176,37 @@
 	setSplashStatus( tr("Reading Preferences") );
 	m_prefsManager.readPrefs();
 
+	// This is a very basic implemenation of the UI theme palette.
+	// If necessary implement platform specific theme configurations here.
+
+	// Apply different palette only if the system UI palette is different.
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
+	if (m_prefsManager.appPrefs.uiPrefs.stylePalette == "dark" && QApplication::styleHints()->colorScheme() == Qt::ColorScheme::Light)
+	{
+		QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Dark);
+
+	// https://bugreports.qt.io/browse/QTBUG-132929
+#if (defined Q_OS_LINUX)
+		QPalette pal(QColor(49, 49, 49));
+		QApplication::setPalette(pal);
+#endif
+		m_SplashScreen->setPixmap(m_iconManager.splashScreen());
+	}
+	else if (m_prefsManager.appPrefs.uiPrefs.stylePalette == "light" && QApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark)
+	{
+		QApplication::styleHints()->setColorScheme(Qt::ColorScheme::Light);
+
+	// https://bugreports.qt.io/browse/QTBUG-132929
+#if (defined Q_OS_LINUX)
+		QPalette pal(QColor(239, 239, 239));
+		QApplication::setPalette(pal);
+#endif
+		m_SplashScreen->setPixmap(m_iconManager.splashScreen());
+	}
+	else
+		QApplication::setPalette(QApplication::style()->standardPalette());
+#endif
+
 	// Configure GUI
 	const QString& prefsUiStyle = m_prefsManager.appPrefs.uiPrefs.style;
 	if (prefsUiStyle.length() > 0)
Index: scribus/ui/prefs_userinterface.cpp
===================================================================
--- scribus/ui/prefs_userinterface.cpp	(Revision 26726)
+++ scribus/ui/prefs_userinterface.cpp	(Arbeitskopie)
@@ -9,6 +9,7 @@
 #include <QFontDialog>
 #include <QPixmap>
 #include <QStyleFactory>
+#include <QStyleHints>
 
 #include "iconmanager.h"
 #include "langmgr.h"
@@ -59,6 +60,12 @@
 
 void Prefs_UserInterface::languageChange()
 {
+	themePaletteComboBox->clear();
+	themePaletteComboBox->addItem(tr("Auto"), "auto");
+	themePaletteComboBox->addItem(tr("Light"), "light");
+	themePaletteComboBox->addItem(tr("Dark"), "dark");
+	themePaletteComboBox->setToolTip( "<qt>" + tr( "Choose the default theme palette. Auto uses the systems default." ) + "</qt>");
+
 	themeComboBox->setToolTip( "<qt>" + tr( "Choose the default window decoration and looks. Scribus inherits any available KDE or Qt themes, if Qt is configured to search KDE plugins." ) + "</qt>");
 	iconSetComboBox->setToolTip( "<qt>" + tr( "Choose the default icon set" ) + "</qt>");
 	useSmallWidgetsCheckBox->setToolTip( "<qt>" + tr( "Palette windows will use smaller (space savvy) widgets. Requires application restart." ) + "</qt>");
@@ -92,6 +99,13 @@
 		selectedGUILang = "en_GB";
 		langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
 	}
+
+	int index = themePaletteComboBox->findData(prefsData->uiPrefs.stylePalette);
+	if ( index != -1 )
+		themePaletteComboBox->setCurrentIndex(index);
+	else
+		themePaletteComboBox->setCurrentIndex(0);
+
 	setCurrentComboItem(languageComboBox, langString);
 	numberFormatComboBox->setCurrentIndex(prefsData->uiPrefs.userPreferredLocale == "System" ? 0 : 1);
 	setCurrentComboItem(themeComboBox, prefsData->uiPrefs.style);
@@ -118,6 +132,7 @@
 	prefsData->uiPrefs.language = selectedGUILang;
 	prefsData->uiPrefs.userPreferredLocale = numberFormatComboBox->currentData().toString();
 	prefsData->uiPrefs.style = themeComboBox->currentText();
+	prefsData->uiPrefs.stylePalette = themePaletteComboBox->currentData().toString();
 	prefsData->uiPrefs.iconSet = IconManager::instance().baseNameForTranslation(iconSetComboBox->currentText());
 	prefsData->uiPrefs.applicationFontSize = fontSizeMenuSpinBox->value();
 	prefsData->uiPrefs.paletteFontSize = fontSizePaletteSpinBox->value();
@@ -133,6 +148,7 @@
 
 	prefsData->storyEditorPrefs.guiFont = seFont.toString();
 	prefsData->storyEditorPrefs.smartTextSelection = storyEditorUseSmartSelectionCheckBox->isChecked();
+
 }
 
 void Prefs_UserInterface::setSelectedGUILang(const QString &newLang)
Index: scribus/ui/prefs_userinterfacebase.ui
===================================================================
--- scribus/ui/prefs_userinterfacebase.ui	(Revision 26726)
+++ scribus/ui/prefs_userinterfacebase.ui	(Arbeitskopie)
@@ -39,7 +39,7 @@
    <item>
     <widget class="Line" name="line">
      <property name="orientation">
-      <enum>Qt::Horizontal</enum>
+      <enum>Qt::Orientation::Horizontal</enum>
      </property>
     </widget>
    </item>
@@ -68,7 +68,7 @@
        <item>
         <widget class="Line" name="line_3">
          <property name="orientation">
-          <enum>Qt::Horizontal</enum>
+          <enum>Qt::Orientation::Horizontal</enum>
          </property>
         </widget>
        </item>
@@ -75,7 +75,7 @@
        <item>
         <layout class="QFormLayout" name="formLayout">
          <property name="fieldGrowthPolicy">
-          <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+          <enum>QFormLayout::FieldGrowthPolicy::FieldsStayAtSizeHint</enum>
          </property>
          <item row="0" column="0">
           <widget class="QLabel" name="themeLabel">
@@ -90,7 +90,7 @@
          <item row="0" column="1">
           <widget class="QComboBox" name="themeComboBox"/>
          </item>
-         <item row="1" column="0">
+         <item row="2" column="0">
           <widget class="QLabel" name="label_3">
            <property name="text">
             <string>Icon Set:</string>
@@ -97,10 +97,10 @@
            </property>
           </widget>
          </item>
-         <item row="1" column="1">
+         <item row="2" column="1">
           <widget class="QComboBox" name="iconSetComboBox"/>
          </item>
-         <item row="2" column="1">
+         <item row="3" column="1">
           <widget class="QCheckBox" name="useSmallWidgetsCheckBox">
            <property name="text">
             <string>Use Small Widgets on Palettes</string>
@@ -107,7 +107,7 @@
            </property>
           </widget>
          </item>
-         <item row="5" column="1">
+         <item row="6" column="1">
           <widget class="QCheckBox" name="useTabsForDocumentsCheckBox">
            <property name="text">
             <string>Use Tabs for Documents</string>
@@ -114,7 +114,7 @@
            </property>
           </widget>
          </item>
-         <item row="6" column="0">
+         <item row="7" column="0">
           <widget class="QLabel" name="recentDocumentsLabel">
            <property name="text">
             <string>&amp;Recent Documents:</string>
@@ -124,10 +124,10 @@
            </property>
           </widget>
          </item>
-         <item row="6" column="1">
+         <item row="7" column="1">
           <widget class="QSpinBox" name="recentDocumentsSpinBox"/>
          </item>
-         <item row="3" column="1">
+         <item row="4" column="1">
           <widget class="QCheckBox" name="showLabels">
            <property name="text">
             <string>Show Informational Labels</string>
@@ -134,7 +134,7 @@
            </property>
           </widget>
          </item>
-         <item row="4" column="1">
+         <item row="5" column="1">
           <widget class="QCheckBox" name="showLabelsOfInactiveTabs">
            <property name="text">
             <string>Show Labels of Inactive Palette Tabs</string>
@@ -141,15 +141,25 @@
            </property>
           </widget>
          </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="themePaletteLabel">
+           <property name="text">
+            <string>Appearance:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QComboBox" name="themePaletteComboBox"/>
+         </item>
         </layout>
        </item>
        <item>
         <spacer name="verticalSpacer_6">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
+          <enum>QSizePolicy::Policy::Fixed</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -174,7 +184,7 @@
        <item>
         <widget class="Line" name="line_4">
          <property name="orientation">
-          <enum>Qt::Horizontal</enum>
+          <enum>Qt::Orientation::Horizontal</enum>
          </property>
         </widget>
        </item>
@@ -211,10 +221,10 @@
        <item>
         <spacer name="verticalSpacer_4">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeType">
-          <enum>QSizePolicy::Fixed</enum>
+          <enum>QSizePolicy::Policy::Fixed</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -239,7 +249,7 @@
        <item>
         <widget class="Line" name="line_2">
          <property name="orientation">
-          <enum>Qt::Horizontal</enum>
+          <enum>Qt::Orientation::Horizontal</enum>
          </property>
         </widget>
        </item>
@@ -284,7 +294,7 @@
        <item>
         <spacer name="verticalSpacer_3">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -304,7 +314,7 @@
        <item>
         <layout class="QFormLayout" name="formLayout_3">
          <property name="fieldGrowthPolicy">
-          <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+          <enum>QFormLayout::FieldGrowthPolicy::FieldsStayAtSizeHint</enum>
          </property>
          <item row="0" column="0">
           <widget class="QLabel" name="storyEditorFontLabel">
@@ -332,7 +342,7 @@
        <item>
         <spacer name="verticalSpacer_5">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -352,7 +362,7 @@
        <item>
         <layout class="QFormLayout" name="formLayout_4">
          <property name="fieldGrowthPolicy">
-          <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+          <enum>QFormLayout::FieldGrowthPolicy::FieldsStayAtSizeHint</enum>
          </property>
          <item row="0" column="0">
           <widget class="QLabel" name="resizeMoveDelayLabel">
@@ -392,7 +402,7 @@
        <item>
         <spacer name="verticalSpacer_2">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
@@ -430,7 +440,7 @@
        <item>
         <spacer name="verticalSpacer">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Orientation::Vertical</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
uitheme_2025-02-26_01.patch (20,256 bytes)   

cbradney

2025-02-27 20:23

administrator   ~0052135

Mostly fixed. Document title bar does not change yet...
image-2.png (107,354 bytes)   
image-2.png (107,354 bytes)   

nitramr

2025-02-28 09:58

developer   ~0052138

I don't think we can change that. The window decoration comes from the operating system. I guess your OS theme is dark, and you forced a light theme in Scribus?

Issue History

Date Modified Username Field Change
2025-01-27 10:10 nitramr New Issue
2025-01-27 18:11 ale Note Added: 0051952
2025-01-27 20:46 cbradney Note Added: 0051953
2025-02-24 22:41 nitramr Note Added: 0052116
2025-02-24 22:41 nitramr File Added: uitheme_2025-02-24_01.patch
2025-02-24 22:41 nitramr Patch No => Yes
2025-02-24 22:46 nitramr Note Added: 0052117
2025-02-25 22:02 nitramr Note Added: 0052123
2025-02-25 22:02 nitramr File Added: uitheme_2025-02-25_01.patch
2025-02-26 19:18 cbradney Note Added: 0052124
2025-02-26 19:18 cbradney File Added: image.png
2025-02-26 19:24 nitramr Note Added: 0052125
2025-02-26 22:04 nitramr Note Added: 0052128
2025-02-26 22:04 nitramr File Added: uitheme_2025-02-26_01.patch
2025-02-27 14:10 nitramr Relationship added related to 0017279
2025-02-27 20:23 cbradney Note Added: 0052135
2025-02-27 20:23 cbradney File Added: image-2.png
2025-02-28 09:58 nitramr Note Added: 0052138