[latex3-commits] [git/LaTeX3-latex3-latex3] main: Support for "&spot" color (62d5433fb)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Aug 22 09:18:20 CEST 2022


Repository : https://github.com/latex3/latex3
On branch  : main
Link       : https://github.com/latex3/latex3/commit/62d5433fb44330d5f0af1b96bf39aedd44d61420

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

commit 62d5433fb44330d5f0af1b96bf39aedd44d61420
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Aug 22 08:18:20 2022 +0100

    Support for "&spot" color
    
    This matches the naming from xcolor: the model
    here doesn't map at all to our approach, so this is
    a fallback.


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

62d5433fb44330d5f0af1b96bf39aedd44d61420
 l3kernel/CHANGELOG.md             |  3 ++-
 l3kernel/l3color.dtx              | 11 +++++++++++
 l3kernel/testfiles/m3color002.lvt |  6 ++++++
 l3kernel/testfiles/m3color002.tlg | 17 +++++++++++++----
 4 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 3680b6252..3684d6126 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -12,7 +12,8 @@ this project uses date-based 'snapshot' version identifiers.
   strings with `\str_(g)set_convert:Nnnn`. 
 - `\color_if_exist:n(TF)`
 - Support for case changing Vietnamese characters with 8-bit engines
-- Support for `cmy` color model
+- Parsing of `cmy` and `&spot` color models to support data exchange with
+  `xcolor`
 
 ### Changed
 - Replace `LaTeX3` in message text by `LaTeX`
diff --git a/l3kernel/l3color.dtx b/l3kernel/l3color.dtx
index 119b10580..cd25053e6 100644
--- a/l3kernel/l3color.dtx
+++ b/l3kernel/l3color.dtx
@@ -125,6 +125,8 @@
 % \begin{itemize}
 %   \item \texttt{cmy} Cyan-magenta-yellow color with three axes, one for
 %     each of the components; converted to |cmyk|
+%   \item \texttt{\&spot} Spot color tint with one value; treated as a gray
+%     tint as spot color data is not available for extraction
 % \end{itemize}
 %
 % To allow parsing of data from \pkg{xcolor}, any leading model up the first
@@ -1296,6 +1298,15 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\@@_parse_model_&spot:w}
+%   We cannot extract data here from that passed by \pkg{xcolor}, so
+%   we fall back on a black tint. 
+%    \begin{macrocode}
+\cs_new:cpn { @@_parse_model_&spot:w } #1 , #2 \s_@@_stop
+  { { gray } { #1 } }
+%    \end{macrocode}
+% \end{macro}
+%
 % \subsection{Selecting colors (and color models)}
 %
 % \begin{variable}{\l_color_fixed_model_tl}
diff --git a/l3kernel/testfiles/m3color002.lvt b/l3kernel/testfiles/m3color002.lvt
index 6a7a4d574..6e125a365 100644
--- a/l3kernel/testfiles/m3color002.lvt
+++ b/l3kernel/testfiles/m3color002.lvt
@@ -86,6 +86,12 @@
     \color_show:n { foo1 }
   }
 
+\TEST { &spot~model }
+  {
+    \color_set:nnn { foo1 } { &spot } {  0.54 }
+    \color_show:n { foo1 }
+  }
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \TEST { Exporting~colors }
diff --git a/l3kernel/testfiles/m3color002.tlg b/l3kernel/testfiles/m3color002.tlg
index 655bc6b31..c75d1324b 100644
--- a/l3kernel/testfiles/m3color002.tlg
+++ b/l3kernel/testfiles/m3color002.tlg
@@ -196,7 +196,16 @@ The color foo1 has the properties:
 l. ...  }
 ============================================================
 ============================================================
-TEST 7: Exporting colors
+TEST 7: &spot model
+============================================================
+The color foo1 has the properties:
+>  model  =>  gray
+>  gray  =>  0.54.
+<recently read> }
+l. ...  }
+============================================================
+============================================================
+TEST 8: Exporting colors
 ============================================================
 > \l_tmpa_tl={rgb}{0.0 0.0 1.0}.
 <recently read> }
@@ -248,7 +257,7 @@ l. ...  }
 l. ...  }
 ============================================================
 ============================================================
-TEST 8: Exporting color: errors
+TEST 9: Exporting color: errors
 ============================================================
 ! LaTeX Error: Unknown export format 'mumble'.
 For immediate help type H <return>.
@@ -258,7 +267,7 @@ LaTeX has been asked to export a color in format 'mumble', but this has never
 been defined.
 ============================================================
 ============================================================
-TEST 9: Exporting complex models
+TEST 10: Exporting complex models
 ============================================================
 > \l_tmpa_tl={BarToneCMYK}{0.6}.
 <recently read> }
@@ -298,7 +307,7 @@ l. ...  }
 l. ...  }
 ============================================================
 ============================================================
-TEST 10: Multiple models
+TEST 11: Multiple models
 ============================================================
 Defining \l__color_named_foo3_tl on line ...
 Defining \l__color_named_foo3_prop on line ...





More information about the latex3-commits mailing list.