View Issue Details

IDProjectCategoryView StatusLast Update
0017952ScribusUser Interfacepublic2026-09-12 13:07
Reporterqirat Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformLinuxOSFedora WorkstationOS Version44
Product Version1.7.4.svn 
Summary0017952: [patch] Make Default Scratch Space Follow the Active Theme
DescriptionThe default Scratch Space colour could remain from the previous theme, leaving the document surround and Arrange Pages background too light/dark.

#Cause: palette-derived default colours could be persisted and later treated like user-customized colours.

#Fix: recognise known palette-derived scratch colours as defaults and update them to the new `Window` colour after the theme palette changes.

* Explicitly customised Scratch Space colours remain untouched.
* Refreshes open document canvases and the Arrange Pages grid immediately when the effective scratch colour changes.
* Uses a proper `PagePalette_Pages` refresh method rather than rebuilding page previews.
Additional InformationThe initial number in the filename suggests the order it is to go while testing my four dark theme fixes (tickets in order: 0017923, 0017924, 0017925, and 0017926, this one.
Tags#please_test
Attached Files
5_dark-theme-default-scratch-color-fix-v1.1.patch (5,303 bytes)   
Index: scribus/ui/factories/scribusproxystyle.cpp
===================================================================
--- scribus/ui/factories/scribusproxystyle.cpp	(revision 27791 + preceding dark-theme fixes)
+++ scribus/ui/factories/scribusproxystyle.cpp	(working copy)
@@ -273,6 +273,17 @@
 #if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
 	blockRefresh = true;
 
+	auto& displayPrefs = PrefsManager::instance().appPrefs.displayPrefs;
+	const QColor windowColor = qApp->palette().color(QPalette::Active, QPalette::Window);
+	const QColor baseWindowColor = baseStyle()->standardPalette().color(QPalette::Active, QPalette::Window);
+	const QColor lightWindowColor = createLightPalette().color(QPalette::Active, QPalette::Window);
+	const QColor darkWindowColor = createDarkPalette().color(QPalette::Active, QPalette::Window);
+	// Scratch space historically stores the palette Window color itself. Accept
+	// palette-derived defaults saved under another theme, while preserving custom colors.
+	const bool useDefaultScratchColor =
+		(displayPrefs.scratchColor == windowColor || displayPrefs.scratchColor == baseWindowColor ||
+		 displayPrefs.scratchColor == lightWindowColor || displayPrefs.scratchColor == darkWindowColor);
+
 	// For Linux exception see bugreport: https://bugreports.qt.io/browse/QTBUG-132929
 
 	switch (theme)
@@ -300,6 +311,9 @@
 		break;
 	}
 
+	if (useDefaultScratchColor)
+		displayPrefs.scratchColor = qApp->palette().color(QPalette::Active, QPalette::Window);
+
 	blockRefresh = false;
 #endif
 }
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 27791 + preceding dark-theme fixes)
+++ scribus/scribus.cpp	(working copy)
@@ -6582,10 +6582,6 @@
 	LocaleManager::instance().setUserPreferredLocale(m_prefsManager.appPrefs.uiPrefs.userPreferredLocale);
 	ScQApp->setLocale();
 
-	bool useDefaultScratchColor = false;
-	if (m_prefsManager.appPrefs.displayPrefs.scratchColor == QApplication::palette().color(QPalette::Active, QPalette::Window))
-		useDefaultScratchColor = true;
-
 #if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
 	QString newUIStylePalette = m_prefsManager.appPrefs.uiPrefs.stylePalette;
 	if (oldPrefs.uiPrefs.stylePalette != newUIStylePalette)
@@ -6621,9 +6617,6 @@
 		// 	m_prefsManager.appPrefs.uiPrefs.style = oldPrefs.uiPrefs.style;
 	}
 
-	if (useDefaultScratchColor)
-		m_prefsManager.appPrefs.displayPrefs.scratchColor = QApplication::palette().color(QPalette::Active, QPalette::Window);
-
 	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 || forceIconUpdate == true)
@@ -6648,6 +6641,10 @@
 	else
 		mdiArea->setViewMode(QMdiArea::SubWindowView);
 	bool shadowChanged = oldPrefs.displayPrefs.showPageShadow != m_prefsManager.showPageShadow();
+	bool scratchColorChanged = oldPrefs.displayPrefs.scratchColor != m_prefsManager.appPrefs.displayPrefs.scratchColor;
+	if (scratchColorChanged)
+		pagePalette->refreshPageGrid();
+
 	QList<QMdiSubWindow *> windows = mdiArea->subWindowList();
 	if (!windows.isEmpty())
 	{
@@ -6672,7 +6669,7 @@
 				scw_v->zoom((scw_v->scale() / oldPrefs.displayPrefs.displayScale) * m_prefsManager.displayScale());
 				zoomSpinBox->setMaximum(doc->opToolPrefs().magMax);
 			}
-			if (shadowChanged)
+			if (shadowChanged || scratchColorChanged)
 				scw->view()->DrawNew();
 		}
 	}
Index: scribus/ui/pagepalette.h
===================================================================
--- scribus/ui/pagepalette.h	(revision 27791 + preceding dark-theme fixes)
+++ scribus/ui/pagepalette.h	(working copy)
@@ -68,6 +68,7 @@
 	void markPage(uint nr);
 	void updateMasterPageList();
 	void updatePagePreviews();
+	void refreshPageGrid();
 
 	void languageChange();
 
Index: scribus/ui/pagepalette.cpp
===================================================================
--- scribus/ui/pagepalette.cpp	(revision 27791 + preceding dark-theme fixes)
+++ scribus/ui/pagepalette.cpp	(working copy)
@@ -165,6 +165,12 @@
 
 }
 
+void PagePalette::refreshPageGrid()
+{
+	if (m_pageWidget)
+		m_pageWidget->refreshPageGrid();
+}
+
 bool PagePalette::masterPageMode()
 {
 	PagePalette_MasterPages* mpWidget = dynamic_cast<PagePalette_MasterPages*>(this->currentWidget());
Index: scribus/ui/pagepalette_pages.h
===================================================================
--- scribus/ui/pagepalette_pages.h	(revision 27791 + preceding dark-theme fixes)
+++ scribus/ui/pagepalette_pages.h	(working copy)
@@ -27,6 +27,7 @@
 public:
 	PagePalette_Pages(QWidget* parent);
 	~PagePalette_Pages() {};
+	void refreshPageGrid();
 
 public slots:
 	void setView(ScribusView *view);
Index: scribus/ui/pagepalette_pages.cpp
===================================================================
--- scribus/ui/pagepalette_pages.cpp	(revision 27791 + preceding dark-theme fixes)
+++ scribus/ui/pagepalette_pages.cpp	(working copy)
@@ -240,6 +240,11 @@
 
 }
 
+void PagePalette_Pages::refreshPageGrid()
+{
+	pageViewWidget->pageGrid()->update();
+}
+
 void PagePalette_Pages::updatePagePreview()
 {
 	if (currView == nullptr || pageViewWidget->pageGrid()->pageList.empty())
PatchYes

Activities

qirat

2026-09-12 13:07

reporter   ~0054456

Here is an improvement.

* Improves on `5_dark-theme-default-scratch-color-fix-v1.1.patch` by replacing its repeated RGB-based detection with explicit persisted theme-following/custom state.
* Removes the need to keep extending a list of recognised Light/Dark/default colours when theme palettes change.
* Preserves genuinely custom scratch colours even when they happen to match a theme colour.
* Adds a simple reset-to-theme workflow: choosing a colour makes it custom; the reset icon restores theme-following.
* Centralizes the effective scratch colour so canvas, Arrange Pages and previews stay consistent.
* Refreshes existing views immediately when the effective scratch colour changes.
* Final patch: `theme-aware-scratch-color-v1.03.patch`.
theme-aware-scratch-color-v1.03.patch (19,071 bytes)   
Index: scribus/canvas.cpp
===================================================================
--- scribus/canvas.cpp	(revision 27829)
+++ scribus/canvas.cpp	(working copy)
@@ -964,7 +964,7 @@
 	img.setDevicePixelRatio(devicePixelRatioF());
 
 	auto painter = std::make_unique<ScPainter>(&img, img.width(), img.height(), 1.0, 0);
-	painter->clear(PrefsManager::instance().appPrefs.displayPrefs.scratchColor);
+	painter->clear(PrefsManager::instance().scratchColor());
 	painter->newPath();
 	painter->moveTo(0, 0);
 	painter->lineTo(clipw, 0);
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(revision 27829)
+++ scribus/prefsmanager.cpp	(working copy)
@@ -270,6 +270,7 @@
 	appPrefs.opToolPrefs.constrain = 15.0;
 	appPrefs.displayPrefs.paperColor = QColor(Qt::white);
 	appPrefs.displayPrefs.scratchColor = QApplication::palette().color(QPalette::Active, QPalette::Window);
+	appPrefs.displayPrefs.scratchColorFollowsTheme = true;
 	appPrefs.displayPrefs.showPageShadow = true;
 	appPrefs.displayPrefs.showVerifierWarningsOnCanvas = true;
 	appPrefs.displayPrefs.showAutosaveClockOnCanvas = false;
@@ -1325,6 +1326,13 @@
 	return appPrefs.displayPrefs.displayScale;
 }
 
+QColor PrefsManager::scratchColor() const
+{
+	if (appPrefs.displayPrefs.scratchColorFollowsTheme)
+		return QApplication::palette().color(QPalette::Active, QPalette::Window);
+	return appPrefs.displayPrefs.scratchColor;
+}
+
 const QString& PrefsManager::uiLanguage() const
 {
 	return appPrefs.uiPrefs.language;
@@ -1486,6 +1494,7 @@
 	deDisplay.setAttribute("ShowPageShadow", static_cast<int>(appPrefs.displayPrefs.showPageShadow));
 	deDisplay.setAttribute("PageColor", appPrefs.displayPrefs.paperColor.name());
 	deDisplay.setAttribute("ScratchColor", appPrefs.displayPrefs.scratchColor.name());
+	deDisplay.setAttribute("ScratchColorFollowsTheme", static_cast<int>(appPrefs.displayPrefs.scratchColorFollowsTheme));
 	deDisplay.setAttribute("FrameSelectedColor", appPrefs.displayPrefs.frameColor.name());
 	deDisplay.setAttribute("FrameNormColor", appPrefs.displayPrefs.frameNormColor.name());
 	deDisplay.setAttribute("FrameGroupColor", appPrefs.displayPrefs.frameGroupColor.name());
@@ -2147,6 +2156,25 @@
 				appPrefs.displayPrefs.scratchColor = QColor(dc.attribute("ScratchColor"));
 			else
 				appPrefs.displayPrefs.scratchColor = QApplication::palette().color(QPalette::Active, QPalette::Window);
+
+			if (dc.hasAttribute("ScratchColorFollowsTheme"))
+				appPrefs.displayPrefs.scratchColorFollowsTheme = static_cast<bool>(dc.attribute("ScratchColorFollowsTheme", "1").toInt());
+			else
+			{
+				// Legacy preferences stored only an RGB value. Migrate known Scribus
+				// theme defaults once, while preserving all other values as custom.
+				const QColor currentWindowColor = QApplication::palette().color(QPalette::Active, QPalette::Window);
+				bool followsTheme = (appPrefs.displayPrefs.scratchColor == currentWindowColor);
+
+				QStyle* fusionStyle = QStyleFactory::create("Fusion");
+				if (fusionStyle)
+				{
+					followsTheme |= (appPrefs.displayPrefs.scratchColor == fusionStyle->standardPalette().color(QPalette::Active, QPalette::Window));
+					delete fusionStyle;
+				}
+				followsTheme |= (appPrefs.displayPrefs.scratchColor == QColor(53, 53, 53));
+				appPrefs.displayPrefs.scratchColorFollowsTheme = followsTheme;
+			}
 			appPrefs.displayPrefs.frameColor = QColor(dc.attribute("FrameSelectedColor", "#ff0000"));
 			appPrefs.displayPrefs.frameNormColor = QColor(dc.attribute("FrameNormColor", "#000000"));
 			appPrefs.displayPrefs.frameGroupColor = QColor(dc.attribute("FrameGroupColor", "#008080"));
Index: scribus/prefsmanager.h
===================================================================
--- scribus/prefsmanager.h	(revision 27829)
+++ scribus/prefsmanager.h	(working copy)
@@ -141,6 +141,7 @@
 	int mouseWheelJump() const;
 	//! \brief Get the user set display scale
 	double displayScale() const;
+	QColor scratchColor() const;
 	//! \brief Get the GUI language from preferences
 	const QString& uiLanguage() const;
 	//! \brief Get the GUI style from preferences
Index: scribus/prefsstructs.h
===================================================================
--- scribus/prefsstructs.h	(revision 27829)
+++ scribus/prefsstructs.h	(working copy)
@@ -376,7 +376,8 @@
 	bool marginColored; //! Indicates if the margin to edge of page area will be colored in some other color or not
 	bool showPageShadow; //! Show a shadow around the pages
 	QColor paperColor; //! Color of paper (onscreen only)
-	QColor scratchColor; //! Color of scratch space (onscreen only)
+	QColor scratchColor; //! Custom color of scratch space (onscreen only)
+	bool scratchColorFollowsTheme; //! Use the application theme Window color for scratch space
 	QColor frameColor; //! Color of frame border (onscreen only)
 	QColor frameNormColor; //! Color of normal frame border (onscreen only)
 	QColor frameGroupColor; //! Color of border of grouped frames (onscreen only)
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 27829)
+++ scribus/scribus.cpp	(working copy)
@@ -6581,9 +6581,9 @@
 	LocaleManager::instance().setUserPreferredLocale(m_prefsManager.appPrefs.uiPrefs.userPreferredLocale);
 	ScQApp->setLocale();
 
-	bool useDefaultScratchColor = false;
-	if (m_prefsManager.appPrefs.displayPrefs.scratchColor == QApplication::palette().color(QPalette::Active, QPalette::Window))
-		useDefaultScratchColor = true;
+	const bool scratchColorSettingChanged =
+		(oldPrefs.displayPrefs.scratchColorFollowsTheme != m_prefsManager.appPrefs.displayPrefs.scratchColorFollowsTheme) ||
+		(oldPrefs.displayPrefs.scratchColor != m_prefsManager.appPrefs.displayPrefs.scratchColor);
 
 #if (QT_VERSION >= QT_VERSION_CHECK(6, 8, 0))
 	QString newUIStylePalette = m_prefsManager.appPrefs.uiPrefs.stylePalette;
@@ -6620,8 +6620,10 @@
 		// 	m_prefsManager.appPrefs.uiPrefs.style = oldPrefs.uiPrefs.style;
 	}
 
-	if (useDefaultScratchColor)
-		m_prefsManager.appPrefs.displayPrefs.scratchColor = QApplication::palette().color(QPalette::Active, QPalette::Window);
+	const bool scratchColorThemeChanged =
+		m_prefsManager.appPrefs.displayPrefs.scratchColorFollowsTheme &&
+		((oldPrefs.uiPrefs.stylePalette != m_prefsManager.appPrefs.uiPrefs.stylePalette) ||
+		 (oldPrefs.uiPrefs.style != m_prefsManager.appPrefs.uiPrefs.style));
 
 	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
@@ -6647,6 +6649,10 @@
 	else
 		mdiArea->setViewMode(QMdiArea::SubWindowView);
 	bool shadowChanged = oldPrefs.displayPrefs.showPageShadow != m_prefsManager.showPageShadow();
+	const bool scratchColorChanged = scratchColorSettingChanged || scratchColorThemeChanged;
+	if (scratchColorChanged)
+		pagePalette->refreshPageGrid();
+
 	QList<QMdiSubWindow *> windows = mdiArea->subWindowList();
 	if (!windows.isEmpty())
 	{
@@ -6671,8 +6677,10 @@
 				scw_v->zoom((scw_v->scale() / oldPrefs.displayPrefs.displayScale) * m_prefsManager.displayScale());
 				zoomSpinBox->setMaximum(doc->opToolPrefs().magMax);
 			}
-			if (shadowChanged)
-				scw->view()->DrawNew();
+			if (scratchColorChanged)
+				scw_v->refreshScratchColor();
+			if (shadowChanged || scratchColorChanged)
+				scw_v->DrawNew();
 		}
 	}
 
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(revision 27829)
+++ scribus/scribusview.cpp	(working copy)
@@ -123,9 +123,7 @@
 	m_vhRulerHW = Hruler::rulerHeight();
 
 	setObjectName("s");
-	QPalette p = palette();
-	p.setBrush(QPalette::Window, PrefsManager::instance().appPrefs.displayPrefs.scratchColor);
-	setPalette(p);
+	refreshScratchColor();
 	setAttribute(Qt::WA_StaticContents);
 	setAttribute(Qt::WA_InputMethodEnabled, true);
 	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
@@ -2255,6 +2253,20 @@
 	zoom(zoomPointX, zoomPointY, newScale, preservePoint);
 }
 
+void ScribusView::refreshScratchColor()
+{
+	if (PrefsManager::instance().appPrefs.displayPrefs.scratchColorFollowsTheme)
+	{
+		// Clear explicit palette roles so future application palette changes propagate.
+		setPalette(QPalette());
+		return;
+	}
+
+	QPalette p = palette();
+	p.setBrush(QPalette::Window, PrefsManager::instance().scratchColor());
+	setPalette(p);
+}
+
 void ScribusView::DrawNew()
 {
 	// 	qDebug("ScribusView::DrawNew");
Index: scribus/scribusview.h
===================================================================
--- scribus/scribusview.h	(revision 27829)
+++ scribus/scribusview.h	(working copy)
@@ -158,6 +158,7 @@
 	FPoint m_mousePointDoc;
 
 	void updatesOn(bool on);
+	void refreshScratchColor();
 	//CB This MUST now be called AFTER a call to doc->addPage or doc->addMasterPage as it
 	//does NOT create a page anymore.
 	ScPage* addPage(int nr, bool mov = true);
Index: scribus/ui/pagepalette.cpp
===================================================================
--- scribus/ui/pagepalette.cpp	(revision 27829)
+++ scribus/ui/pagepalette.cpp	(working copy)
@@ -165,6 +165,12 @@
 
 }
 
+void PagePalette::refreshPageGrid()
+{
+	if (m_pageWidget)
+		m_pageWidget->refreshPageGrid();
+}
+
 bool PagePalette::masterPageMode()
 {
 	PagePalette_MasterPages* mpWidget = dynamic_cast<PagePalette_MasterPages*>(this->currentWidget());
Index: scribus/ui/pagepalette.h
===================================================================
--- scribus/ui/pagepalette.h	(revision 27829)
+++ scribus/ui/pagepalette.h	(working copy)
@@ -68,6 +68,7 @@
 	void markPage(uint nr);
 	void updateMasterPageList();
 	void updatePagePreviews();
+	void refreshPageGrid();
 
 	void languageChange();
 
Index: scribus/ui/pagepalette_pages.cpp
===================================================================
--- scribus/ui/pagepalette_pages.cpp	(revision 27829)
+++ scribus/ui/pagepalette_pages.cpp	(working copy)
@@ -240,6 +240,11 @@
 
 }
 
+void PagePalette_Pages::refreshPageGrid()
+{
+	pageViewWidget->pageGrid()->update();
+}
+
 void PagePalette_Pages::updatePagePreview()
 {
 	if (currView == nullptr || pageViewWidget->pageGrid()->pageList.empty())
Index: scribus/ui/pagepalette_pages.h
===================================================================
--- scribus/ui/pagepalette_pages.h	(revision 27829)
+++ scribus/ui/pagepalette_pages.h	(working copy)
@@ -27,6 +27,7 @@
 public:
 	PagePalette_Pages(QWidget* parent);
 	~PagePalette_Pages() {};
+	void refreshPageGrid();
 
 public slots:
 	void setView(ScribusView *view);
Index: scribus/ui/pagepalette_widgets.cpp
===================================================================
--- scribus/ui/pagepalette_widgets.cpp	(revision 27829)
+++ scribus/ui/pagepalette_widgets.cpp	(working copy)
@@ -803,12 +803,12 @@
 	int y = m_rowSpace;
 	int offset = 0;
 	QRect selectedPageRect;
-	QColor foregroundColor( PrefsManager::instance().appPrefs.displayPrefs.scratchColor.lightness() <= 128 ? Qt::white : Qt::black);
+	QColor foregroundColor( PrefsManager::instance().scratchColor().lightness() <= 128 ? Qt::white : Qt::black);
 
 	QPainter painter(this);
 
 	// Draw background
-	painter.fillRect(rect(), PrefsManager::instance().appPrefs.displayPrefs.scratchColor);
+	painter.fillRect(rect(), PrefsManager::instance().scratchColor());
 
 	if (pageCount() == 0) return;
 
Index: scribus/ui/preferences/prefs_display.cpp
===================================================================
--- scribus/ui/preferences/prefs_display.cpp	(revision 27829)
+++ scribus/ui/preferences/prefs_display.cpp	(working copy)
@@ -30,6 +30,7 @@
 	m_icon = "pref-display";
 
 	buttonRestoreDPI->setIcon(IconManager::instance().loadIcon("pref-display"));
+	scratchSpaceColorResetButton->setIcon(IconManager::instance().loadIcon("reset"));
 
 	connect(pageFillColorButton, SIGNAL(clicked()), this, SLOT(changePaperColor()));
 	connect(showRulersRelativeToPageCheckBox, &QCheckBox::toggled, this, [this](bool on) { if (on) showRulersRelativeToEachPageCheckBox->setChecked(false); });
@@ -38,6 +39,7 @@
 	if (m_doc == nullptr && !ScCore->primaryMainWindow()->HaveDoc)
 	{
 		connect(scratchSpaceColorButton, SIGNAL(clicked()), this, SLOT(changeScratchColor()));
+		connect(scratchSpaceColorResetButton, &QToolButton::clicked, this, &Prefs_Display::resetScratchColor);
 		connect(frameSelectedColorButton, SIGNAL(clicked()), this, SLOT(changeFrameColor()));
 		connect(frameColorButton, SIGNAL(clicked()), this, SLOT(changeNormFrameColor()));
 		connect(frameGroupedColorButton, SIGNAL(clicked()), this, SLOT(changeGroupFrameColor()));
@@ -53,6 +55,7 @@
 	else
 	{
 		scratchSpaceColorButton->setEnabled(false);
+		scratchSpaceColorResetButton->setEnabled(false);
 		frameSelectedColorButton->setEnabled(false);
 		frameColorButton->setEnabled(false);
 		frameGroupedColorButton->setEnabled(false);
@@ -73,6 +76,8 @@
 void Prefs_Display::languageChange()
 {
 	pageFillColorButton->setToolTip( "<qt>" + tr( "Color for paper (onscreen)" ) + "</qt>");
+	scratchSpaceColorButton->setToolTip("<qt>" + tr("Set a custom scratch space color") + "</qt>");
+	scratchSpaceColorResetButton->setToolTip("<qt>" + tr("Use the interface theme color<br/>for scratch space") + "</qt>");
 	showUnprintableAreaInMarginColorCheckBox->setToolTip( "<qt>" + tr( "Mask the area outside the margins in the margin color" ) + "</qt>" );
 	showTextChainsCheckBox->setToolTip( "<qt>" + tr("Enable or disable the display of linked frames") + "</qt>");
 	showControlCharsCheckBox->setToolTip( "<qt>" + tr("Display non-printing characters such as paragraph markers in text frames") + "</qt>");
@@ -140,10 +145,10 @@
 	pageFillColorButton->setText( QString() );
 	pageFillColorButton->setIcon(pm);
 
-	pm.fill(prefsData->displayPrefs.scratchColor);
 	colorScratch = prefsData->displayPrefs.scratchColor;
+	m_scratchColorFollowsTheme = prefsData->displayPrefs.scratchColorFollowsTheme;
 	scratchSpaceColorButton->setText( QString() );
-	scratchSpaceColorButton->setIcon(pm);
+	updateScratchColorControls();
 
 	pm.fill(prefsData->displayPrefs.frameColor);
 	colorFrame = prefsData->displayPrefs.frameColor;
@@ -296,18 +301,38 @@
 	}
 }
 
+void Prefs_Display::updateScratchColorControls()
+{
+	const QColor displayColor = m_scratchColorFollowsTheme
+		? QApplication::palette().color(QPalette::Active, QPalette::Window)
+		: colorScratch;
+
+	QPixmap pm(100, 30);
+	pm.fill(displayColor);
+	scratchSpaceColorButton->setIcon(pm);
+	scratchSpaceColorResetButton->setEnabled(scratchSpaceColorButton->isEnabled() && !m_scratchColorFollowsTheme);
+}
+
 void Prefs_Display::changeScratchColor()
 {
-	QColor newColor(QColorDialog::getColor(colorScratch, this));
+	const QColor initialColor = m_scratchColorFollowsTheme
+		? QApplication::palette().color(QPalette::Active, QPalette::Window)
+		: colorScratch;
+	QColor newColor(QColorDialog::getColor(initialColor, this));
 	if (newColor.isValid())
 	{
-		QPixmap pm(100, 30);
-		pm.fill(newColor);
 		colorScratch = newColor;
-		scratchSpaceColorButton->setIcon(pm);
+		m_scratchColorFollowsTheme = false;
+		updateScratchColorControls();
 	}
 }
 
+void Prefs_Display::resetScratchColor()
+{
+	m_scratchColorFollowsTheme = true;
+	updateScratchColorControls();
+}
+
 void Prefs_Display::changeFrameColor()
 {
 	QColor newColor(QColorDialog::getColor(colorFrame, this));
@@ -434,6 +459,7 @@
 
 	prefsData->displayPrefs.paperColor = colorPaper;
 	prefsData->displayPrefs.scratchColor = colorScratch;
+	prefsData->displayPrefs.scratchColorFollowsTheme = m_scratchColorFollowsTheme;
 	prefsData->displayPrefs.frameColor = colorFrame;
 	prefsData->displayPrefs.frameNormColor = colorFrameNorm;
 	prefsData->displayPrefs.frameGroupColor = colorFrameGroup;
Index: scribus/ui/preferences/prefs_display.h
===================================================================
--- scribus/ui/preferences/prefs_display.h	(revision 27829)
+++ scribus/ui/preferences/prefs_display.h	(working copy)
@@ -51,6 +51,8 @@
 		*/
 		virtual void changePaperColor();
 		virtual void changeScratchColor();
+		void resetScratchColor();
+		void updateScratchColorControls();
 		virtual void changeFrameColor();
 		virtual void changeNormFrameColor();
 		virtual void changeGroupFrameColor();
@@ -74,6 +76,7 @@
 		QColor colorFrameAnnotation;
 		QColor colorPageBorder;
 		QColor colorControlChars;
+		bool m_scratchColorFollowsTheme { true };
 		double displayScale;
 		ScribusDoc* m_doc;
 
Index: scribus/ui/preferences/prefs_displaybase.ui
===================================================================
--- scribus/ui/preferences/prefs_displaybase.ui	(revision 27829)
+++ scribus/ui/preferences/prefs_displaybase.ui	(working copy)
@@ -437,11 +437,37 @@
             </widget>
            </item>
            <item row="1" column="1">
-            <widget class="QPushButton" name="scratchSpaceColorButton">
-             <property name="text">
-              <string/>
+            <layout class="QHBoxLayout" name="scratchSpaceColorLayout">
+             <property name="spacing">
+              <number>6</number>
              </property>
-            </widget>
+             <property name="leftMargin">
+              <number>0</number>
+             </property>
+             <property name="topMargin">
+              <number>0</number>
+             </property>
+             <property name="rightMargin">
+              <number>0</number>
+             </property>
+             <property name="bottomMargin">
+              <number>0</number>
+             </property>
+             <item>
+              <widget class="QPushButton" name="scratchSpaceColorButton">
+               <property name="text">
+                <string/>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QToolButton" name="scratchSpaceColorResetButton">
+               <property name="text">
+                <string/>
+               </property>
+              </widget>
+             </item>
+            </layout>
            </item>
            <item row="2" column="0">
             <widget class="QLabel" name="label_13">
Index: scribus/ui/widgets/pagesizepreview.cpp
===================================================================
--- scribus/ui/widgets/pagesizepreview.cpp	(revision 27829)
+++ scribus/ui/widgets/pagesizepreview.cpp	(working copy)
@@ -11,7 +11,7 @@
 void PageSizePreview::paintEvent(QPaintEvent *event)
 {
 	QColor colPage = PrefsManager::instance().appPrefs.displayPrefs.paperColor;
-	QColor colBackground = PrefsManager::instance().appPrefs.displayPrefs.scratchColor;
+	QColor colBackground = PrefsManager::instance().scratchColor();
 	QColor colMargin = PrefsManager::instance().appPrefs.guidesPrefs.marginColor;
 	QColor colBleed(Qt::gray);
 	QColor colFrame(Qt::black);

Issue History

Date Modified Username Field Change
2026-08-29 10:25 qirat New Issue
2026-08-29 10:25 qirat File Added: 5_dark-theme-default-scratch-color-fix-v1.1.patch
2026-08-29 10:49 qirat Tag Attached: #please_test
2026-09-12 13:07 qirat Note Added: 0054456
2026-09-12 13:07 qirat File Added: theme-aware-scratch-color-v1.03.patch