--- a/eric7/Preferences/ConfigurationPages/DiffColoursPage.py Tue Dec 21 15:21:28 2021 +0100 +++ b/eric7/Preferences/ConfigurationPages/DiffColoursPage.py Tue Dec 21 20:42:09 2021 +0100 @@ -8,7 +8,6 @@ """ from PyQt6.QtCore import pyqtSlot -from PyQt6.QtGui import QPalette from PyQt6.QtWidgets import QColorDialog from .ConfigurationPageBase import ConfigurationPageBase @@ -33,9 +32,14 @@ monospacedFont = Preferences.getEditorOtherFonts("MonospacedFont") self.__allSamples = ( - self.textSample, self.addedSample, self.removedSample, - self.replacedSample, self.contextSample, self.headerSample, - self.whitespaceSample) + self.textSample, + self.addedSample, + self.removedSample, + self.replacedSample, + self.contextSample, + self.headerSample, + self.whitespaceSample + ) for sample in self.__allSamples: sample.setFont(monospacedFont) @@ -154,11 +158,16 @@ @type str """ colour = self.__coloursDict[colourKey][0] - for sample in self.__allSamples: - pl = sample.palette() - pl.setColor(QPalette.ColorRole.Text, colour) - sample.setPalette(pl) - sample.repaint() + for key in self.__coloursDict: + if key == "TextColor": + self.__coloursDict[key][1].setStyleSheet( + "QLineEdit {{ color: {0}; }}".format(colour.name()) + ) + else: + self.__coloursDict[key][1].setStyleSheet( + "QLineEdit {{ color: {0}; background-color: {1}; }}" + .format(colour.name(), self.__coloursDict[key][0].name()) + ) def __updateSampleBackgroundColour(self, colourKey): """ @@ -170,10 +179,11 @@ sample = self.__coloursDict[colourKey][1] if sample: colour = self.__coloursDict[colourKey][0] - pl = sample.palette() - pl.setColor(QPalette.ColorRole.Base, colour) - sample.setPalette(pl) - sample.repaint() + sample.setStyleSheet( + "QLineEdit {{ color: {0}; background-color: {1}; }}" + .format(self.__coloursDict["TextColor"][0].name(), + colour.name()) + ) def create(dlg):