def updateColorScheme(settings=settings): settings.beginGroup('ColorScheme') for key in defaultColorScheme: if settings.contains(key): colorScheme[key] = settings.value(key, type=QColor) else: colorScheme[key] = defaultColorScheme[key] settings.endGroup()
def updateColorScheme(settings=settings): palette = QApplication.palette() windowColor = palette.color(QPalette.ColorRole.Window) themeVariant = 'light' if windowColor.lightness() > 150 else 'dark' settings.beginGroup('ColorScheme') for key in colors: if settings.contains(key): colorValues[key] = settings.value(key, type=QColor) else: colorValues[key] = QColor(colors[key][themeVariant]) settings.endGroup()