--- a/RadonMetrics/CyclomaticComplexityDialog.py Tue Jun 23 19:05:32 2020 +0200 +++ b/RadonMetrics/CyclomaticComplexityDialog.py Wed Jun 24 17:32:41 2020 +0200 @@ -15,6 +15,7 @@ sys.path.insert(0, os.path.dirname(__file__)) from PyQt5.QtCore import pyqtSlot, qVersion, Qt, QTimer, QLocale +from PyQt5.QtGui import QColor from PyQt5.QtWidgets import ( QDialog, QDialogButtonBox, QAbstractButton, QHeaderView, QTreeWidgetItem, QApplication, QMenu @@ -106,19 +107,42 @@ "function": "F", "method": "M", } - self.__typeColors = { - "class": Qt.blue, - "function": Qt.darkCyan, - "method": Qt.magenta, - } - self.__rankColors = { - "A": Qt.green, - "B": Qt.green, - "C": Qt.yellow, - "D": Qt.yellow, - "E": Qt.red, - "F": Qt.red, - } + + try: + usesDarkPalette = e5App().usesDarkPalette() + except AttributeError: + from PyQt5.QtGui import QPalette + palette = e5App().palette() + lightness = palette.color(QPalette.Window).lightness() + usesDarkPalette = lightness <= 128 + if usesDarkPalette: + self.__typeColors = { + "class": QColor("#ffe480"), + "function": QColor("#99ffff"), + "method": QColor("#ff99ff"), + } + self.__rankColors = { + "A": QColor("#308030"), + "B": QColor("#308030"), + "C": QColor("#808030"), + "D": QColor("#808030"), + "E": QColor("#803030"), + "F": QColor("#803030"), + } + else: + self.__typeColors = { + "class": QColor("#0000ff"), + "function": QColor("#008080"), + "method": QColor("#ff00ff"), + } + self.__rankColors = { + "A": QColor("#00ff00"), + "B": QColor("#00ff00"), + "C": QColor("#ffff00"), + "D": QColor("#ffff00"), + "E": QColor("#ff0000"), + "F": QColor("#ff0000"), + } self.__menu = QMenu(self) self.__menu.addAction(self.tr("Collapse all"),