commit 29f98ab24518b214052d98087a96a14fbc1a067d
Author: Juergen Spitzmueller <[email protected]>
Date: Tue Jan 19 08:37:05 2021 +0100
Use isDarkMode() method
---
src/BranchList.h | 2 +-
src/frontends/qt/GuiPainter.cpp | 8 ++------
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/BranchList.h b/src/BranchList.h
index c7dd196..cdae7b6 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 4cb4699..3b3b955 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();
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs