[LyX/master] Amend 67a87d81f4d

Juergen Spitzmueller <[email protected]> Tue, 19 May 2026 12:25:49 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 4fd295618a9d3a9c03279078ca91e675b52f5141
Author: Juergen Spitzmueller <[email protected]>
Date:   Tue May 19 14:25:27 2026 +0200

    Amend 67a87d81f4d
    
    Do not fiddle with dynamic colors
---
 src/Color.cpp      | 7 +++++++
 src/ColorSet.h     | 3 +++
 src/RowPainter.cpp | 2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/Color.cpp b/src/Color.cpp
index 19b37f5e5f..3977e998c6 100644
--- a/src/Color.cpp
+++ b/src/Color.cpp
@@ -568,6 +568,13 @@ bool ColorSet::isKnownLyXName(string const & lyxname) const
 }
 
 
+bool ColorSet::isStaticColor(ColorCode c) const
+{
+	return c != Color_none
+			&& (c < Color_cursor || c > Color_ignore);
+}
+
+
 ColorCode ColorSet::getFromLaTeXName(string const & latexname,
 				     bool const warn_not_found) const
 {
diff --git a/src/ColorSet.h b/src/ColorSet.h
index 448475af0e..c9dbaa3da2 100644
--- a/src/ColorSet.h
+++ b/src/ColorSet.h
@@ -101,6 +101,9 @@ public:
 				   bool warn_not_found = true) const;
 	/// Check whether a color exists
 	bool isKnownLyXName(std::string const & lyxname) const;
+	/// Return true if this is a static color (no dynamic
+	/// value depending on dark/light mode)
+	bool isStaticColor(ColorCode c) const;
 
 private:
 	///
diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp
index c8f5b8b3bf..0d01ac1bcc 100644
--- a/src/RowPainter.cpp
+++ b/src/RowPainter.cpp
@@ -262,7 +262,7 @@ void RowPainter::paintStringAndSel(Row::Element const & e) const
 		    && theApp()->isLightColor(rgbFromHexName(lcolor.getX11HexName(pi_.background_color, true))))
 			invert = true;
 		else if (pi_.background_color == Color_background
-			 && e.font.fontInfo().color() != Color_none
+			 && lcolor.isStaticColor(e.font.fontInfo().color())
 			 && !theApp()->isLightColor(rgbFromHexName(lcolor.getX11HexName(e.font.fontInfo().color()))))
 			invert = true;
 	}
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs