Use isDarkMode() method

This commit is contained in:
Juergen Spitzmueller 2021-01-19 08:37:05 +01:00
parent 3259f3c73e
commit 29f98ab245
2 changed files with 3 additions and 7 deletions

View 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.

View 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();