[LyX/master] Let math preview background partially reflect color customization
Koji Yokota <[email protected]> Fri, 24 Jul 2026 14:58:46 +0000
| Newsgroups | gmane.editors.lyx.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit ca60046dcfc30ac6d1cb22ce96b70ec99740843c Author: Koji Yokota <[email protected]> Date: Fri Jul 24 23:58:04 2026 +0900 Let math preview background partially reflect color customization Set math preview background to transparent if the alpha value of math background is smaller than 128 (50%), otherwise it is set to its solid color. --- src/graphics/PreviewLoader.cpp | 5 ++++- src/graphics/PreviewLoader.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 5156922494..def0dcc33a 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -16,6 +16,7 @@ #include "Buffer.h" #include "BufferParams.h" +#include "ColorSet.h" #include "Converter.h" #include "Encoding.h" #include "LyXRC.h" @@ -681,7 +682,9 @@ void PreviewLoader::Impl::startLoading(bool wait) ColorCode const fg = PreviewLoader::foregroundColor(); cs << " --fg " << theApp()->hexName(fg); ColorCode const bg = PreviewLoader::backgroundColor(); - if (bg == Color_transparent) + ARGBColor const bga = argbFromHexName( + lcolor.get32bitHexName(bg, theApp()->isInDarkMode())); + if (bga.a < 128) cs << " --bg \"transparent\""; else cs << " --bg " << theApp()->hexName(bg); diff --git a/src/graphics/PreviewLoader.h b/src/graphics/PreviewLoader.h index 305730dc0a..cc1d94efcd 100644 --- a/src/graphics/PreviewLoader.h +++ b/src/graphics/PreviewLoader.h @@ -90,7 +90,7 @@ public: /// Which buffer owns this loader. Buffer const & buffer() const; /// The background color used - static ColorCode backgroundColor() { return Color_transparent; } + static ColorCode backgroundColor() { return Color_mathbg; } /// The foreground color used static ColorCode foregroundColor() { return Color_preview; } -- lyx-cvs mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-cvs