[latex3-commits] [latex3/latex3] fix-lotfl-color: Improve l3color and (x)color coexistance in LuaLaTeX (80891ca91)

github at latex-project.org github at latex-project.org
Sun Nov 5 22:52:42 CET 2023


Repository : https://github.com/latex3/latex3
On branch  : fix-lotfl-color
Link       : https://github.com/latex3/latex3/commit/80891ca9166fb953881b8fe62712d082533d2cbf

>---------------------------------------------------------------

commit 80891ca9166fb953881b8fe62712d082533d2cbf
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sun Nov 5 22:52:42 2023 +0100

    Improve l3color and (x)color coexistance in LuaLaTeX


>---------------------------------------------------------------

80891ca9166fb953881b8fe62712d082533d2cbf
 l3backend/CHANGELOG.md        |  3 +++
 l3backend/l3backend-color.dtx | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/l3backend/CHANGELOG.md b/l3backend/CHANGELOG.md
index a81f6724b..279e6e787 100644
--- a/l3backend/CHANGELOG.md
+++ b/l3backend/CHANGELOG.md
@@ -6,6 +6,9 @@ this project uses date-based 'snapshot' version identifiers.
 
 ## [Unreleased]
 
+### Changed
+- Changed `luaotfload` integration to allow coexistance with (x)color.
+
 ## [2023-11-04]
 
 ### Fixed
diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index 9b662307e..64c012e22 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -1308,6 +1308,16 @@ if luaotfload and luaotfload.set_transparent_colorstack then
     local html = htmlcolor:match(value)
     if html then return html end
 
+% If no l3color named color with this name is known, check for defined xcolor colors
+    local l3color_prop = token.get_macro(string.format('l__color_named_%s_prop', value))
+    if l3color_prop == nil or l3color_prop == '' then
+      local legacy_color_macro = token.create(string.format('\\color@%s', value))
+      if legacy_color_macro.cmdname ~= 'undefined_cs' then
+        token.put_next(legacy_color_macro)
+        return token.scan_argument()
+      end
+    end
+
     tex.runtoks(function()
       token.get_next()
       color_export[6] = value





More information about the latex3-commits mailing list.