From: Juergen Spitzmueller Date: Tue, 19 Jan 2021 07:37:05 +0000 (+0100) Subject: Use isDarkMode() method X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=29f98ab24518b214052d98087a96a14fbc1a067d;p=features.git Use isDarkMode() method --- diff --git a/src/BranchList.h b/src/BranchList.h index c7dd19603e..cdae7b6d0c 100644 --- a/src/BranchList.h +++ b/src/BranchList.h @@ -63,7 +63,7 @@ public: /// std::string const & color() const; /** - * Set color from a string "#rrggbb". + * Set color from a hexcolor string "#rrggbb" or a lyx color name. * Use Color:background if the string is no valid color. * This ensures compatibility with LyX 1.4.0 that had the symbolic * color "none" that was displayed as Color:background. diff --git a/src/frontends/qt/GuiPainter.cpp b/src/frontends/qt/GuiPainter.cpp index 4cb4699e6a..3b3b955662 100644 --- a/src/frontends/qt/GuiPainter.cpp +++ b/src/frontends/qt/GuiPainter.cpp @@ -242,12 +242,8 @@ void GuiPainter::image(int x, int y, int w, int h, graphics::Image const & i, fillRectangle(x, y, w, h, Color_graphicsbg); QImage image = qlimage.image(); - - QPalette palette = QPalette(); - QColor text_color = palette.color(QPalette::Active, QPalette::WindowText); - QColor bg_color = palette.color(QPalette::Active, QPalette::Window); - // guess whether we are in dark mode - if (revert_in_darkmode && text_color.black() < bg_color.black()) + + if (revert_in_darkmode && guiApp && guiApp->colorCache().isDarkMode()) // FIXME this is only a cheap approximation // Ideally, replace colors as in GuiApplication::prepareForDarkmode() image.invertPixels();