]> git.lyx.org Git - features.git/commitdiff
Use isDarkMode() method
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 19 Jan 2021 07:37:05 +0000 (08:37 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 19 Jan 2021 07:37:05 +0000 (08:37 +0100)
src/BranchList.h
src/frontends/qt/GuiPainter.cpp

index c7dd19603e791171224ca8b35e0cd03f3aee9267..cdae7b6d0cf9aa771d2c4b4d1228a38c6bb36263 100644 (file)
@@ -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.
index 4cb4699e6ac856cffc14604ca86798a00af5997a..3b3b95566247a6d6660102086c442f3844ea6372 100644 (file)
@@ -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();