commit b870cb2e234d41c5d367143cbe7e7d217610c4b2
Author: Juergen Spitzmueller <[email protected]>
Date:   Tue Jun 10 19:03:33 2025 +0200

    Revert non-basic PDF colors
    
    I.e., load the required models in preamble
---
 lib/lyx2lyx/lyx_2_5.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/lib/lyx2lyx/lyx_2_5.py b/lib/lyx2lyx/lyx_2_5.py
index 1ef0cd8249..1bec68e123 100644
--- a/lib/lyx2lyx/lyx_2_5.py
+++ b/lib/lyx2lyx/lyx_2_5.py
@@ -2387,7 +2387,7 @@ def revert_colortbl(document):
         document.body[lay+1 : lay+1] = cmd
         colortbl = True
 
-    # and finally, columncolor
+    # columncolor
     i = 0
     re1 = re.compile(r"^<column .*color=\"([^\"]+)\".*$", re.IGNORECASE)
     re2 = re.compile(r"^<column .*special=\"([^\"]+)\".*$", re.IGNORECASE)
@@ -2474,6 +2474,24 @@ def revert_colortbl(document):
         document.body[i] = document.body[i][:-1] + cmd
         colortbl = True
 
+    # and finally, href colors
+    i = find_token(document.header, "\\pdf_quoted_options", 0)
+    if i != -1:
+        pdfopts = get_quoted_value(document.header, "\\pdf_quoted_options", 
i).split()
+        rex = re.compile(r"^.*color=([^,]+).*$", re.IGNORECASE)
+        for pdfopt in pdfopts:
+            m = rex.match(pdfopt)
+            if not m:
+                continue
+            ccval = m.group(1)
+            if ccval not in handledcolors:
+                # check whether it is a known latexcolor only used here
+                for color in list(xcolor_names):
+                    x11 |= "X11:" + ccval == color
+                    svg |= "SVG:" + ccval == color
+                    dvips |= "DVIPS:" + ccval == color
+                    xcolor |= "X11:" + ccval == color or "SVG:" + ccval == 
color or "DVIPS:" + ccval == color
+
     # To conclude, the preamble stuff
     if xcolor == True:
         opts = []
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to