From c5501860e8e07a53f4bce144d44ed39eda6290ef Mon Sep 17 00:00:00 2001 From: wakonig_k Date: Wed, 28 Aug 2024 14:34:50 +0200 Subject: [PATCH] fix(theme): apply theme to all pyqtgraph widgets on manual updates --- bec_widgets/utils/colors.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bec_widgets/utils/colors.py b/bec_widgets/utils/colors.py index b5df3071..860c0fb3 100644 --- a/bec_widgets/utils/colors.py +++ b/bec_widgets/utils/colors.py @@ -29,6 +29,7 @@ def set_theme(theme: Literal["dark", "light", "auto"]): app = QApplication.instance() bec_qthemes.setup_theme(theme) pg.setConfigOption("background", "w" if app.theme["theme"] == "light" else "k") + apply_theme(theme) # pylint: disable=protected-access if theme != "auto": @@ -44,6 +45,9 @@ def set_theme(theme: Literal["dark", "light", "auto"]): def apply_theme(theme: Literal["dark", "light"]): + """ + Apply the theme to all pyqtgraph widgets. Do not use this function directly. Use set_theme instead. + """ app = QApplication.instance() # go through all pyqtgraph widgets and set background children = itertools.chain.from_iterable(