Skip to content

Commit

Permalink
__main__: Set pyqtgraph colors from QPalette
Browse files Browse the repository at this point in the history
  • Loading branch information
irgolic committed Jul 14, 2021
1 parent 68532b0 commit 7f50f7c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Orange/canvas/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(f'Setting pyqtgraph background to {bg}')
pyqtgraph.setConfigOption('background', bg)
log.info(f'Setting pyqtgraph foreground to {fg}')
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")
Expand Down

0 comments on commit 7f50f7c

Please sign in to comment.