commit 59509e2afa3f3fb3b12b6d89bf9c3096267b9ba4
Author: Juergen Spitzmueller <[email protected]>
Date:   Wed May 6 09:11:32 2026 +0200

    tex2lyx: add support for \colorlet if the second arg is a known LaTeX color 
(#13310)
---
 src/tex2lyx/Preamble.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index 3137e2df74..2a4a9e1a79 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -17,6 +17,7 @@
 #include "tex2lyx.h"
 
 #include "Encoding.h"
+#include "LaTeXColors.h"
 #include "LaTeXPackages.h"
 #include "LayoutFile.h"
 #include "TextClass.h"
@@ -3630,7 +3631,14 @@ void Preamble::parse(Parser & p, string const & 
forceclass,
                                h_backgroundcolor = getLyXColor(color2, true);
                        else if (color1 == "shadecolor")
                                h_boxbgcolor = getLyXColor(color2, true);
-                       else {
+                       else if (theLaTeXColors().isLaTeXColor(color2)) {
+                               for (auto const & cc : 
theLaTeXColors().getLaTeXColors()) {
+                                       if (cc.first == color2) {
+                                               h_custom_colors[color1] = 
ltrim(cc.second.hexname(), "#");
+                                               break;
+                                       }
+                               }
+                       } else {
                                h_preamble << "\\colorlet{" << color1
                                           << "}{" << color2 << '}';
                        }
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to