commit 435473267c3e5e6674822a7fdd57e9b59f55629c
Author: Koji Yokota <[email protected]>
Date:   Wed Jul 29 15:26:48 2026 +0900

    Let math preview adapt to surrounding font color
    
    This is done via adding \color{} in preview LaTeX source.
    Note that dvipng's -fg setting applies to all preview snipets
    so inappropriate to use for colorization of individual math
    symbols.
---
 src/mathed/InsetMathHull.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 96fa9a42c3..ecaf6468b4 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -900,6 +900,11 @@ void InsetMathHull::preparePreview(DocIterator const & pos,
                setfont += from_ascii("\\textbf{");
                endfont += '}';
        }
+       ColorCode color = font.fontInfo().color();
+       if (color != Color_none) {
+               setfont += from_ascii("{\\color{" + lcolor.getLaTeXName(color) 
+ "}");
+               endfont += '}';
+       }
        if (lsize != "normalsize" && !prefixIs(lsize, "error"))
                setfont += from_ascii("\\" + lsize + '\n');
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to