From ac8266483267d1bdf6dd537383b073cc4bb33d65 Mon Sep 17 00:00:00 2001 From: Rafael Irgolic Date: Thu, 18 Feb 2021 22:08:09 +0000 Subject: [PATCH] __main__: Set pyqtgraph colors from QPalette --- Orange/canvas/__main__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Orange/canvas/__main__.py b/Orange/canvas/__main__.py index d374c52e7da..e1ebaa42f6a 100644 --- a/Orange/canvas/__main__.py +++ b/Orange/canvas/__main__.py @@ -457,6 +457,20 @@ def main(argv=None): app.setPalette(breeze_dark()) defaultstylesheet = "darkorange.qss" + # set pyqtgraph colors + def onPaletteChange(): + p = app.palette() + bg = p.base().color().name() + fg = p.windowText().color().name() + + log.info('Setting pyqtgraph background to %s' % bg) + pyqtgraph.setConfigOption('background', bg) + log.info('Setting pyqtgraph foreground to %s' % bg) + pyqtgraph.setConfigOption('foreground', fg) + + app.paletteChanged.connect(onPaletteChange) + onPaletteChange() + palette = app.palette() if style is None and palette.color(QPalette.Window).value() < 127: log.info("Switching default stylesheet to darkorange")