[latex3-commits] [git/LaTeX3-latex3-latex3] color-export: Add "backend" color export (f876b1bbe)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Jun 15 10:04:53 CEST 2020


Repository : https://github.com/latex3/latex3
On branch  : color-export
Link       : https://github.com/latex3/latex3/commit/f876b1bbedf8c9455115a77c50990a919e880658

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

commit f876b1bbedf8c9455115a77c50990a919e880658
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Jun 15 09:04:53 2020 +0100

    Add "backend" color export
    
    This is needed as l3draw uses color.


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

f876b1bbedf8c9455115a77c50990a919e880658
 l3experimental/l3color/l3color.dtx              | 16 ++++++++++++++--
 l3experimental/l3color/testfiles/m3color002.lvt |  2 +-
 l3experimental/l3color/testfiles/m3color002.tlg | 12 ++++++++++++
 l3experimental/l3draw/l3draw-state.dtx          |  2 +-
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/l3experimental/l3color/l3color.dtx b/l3experimental/l3color/l3color.dtx
index 605b916da..fa8876f44 100644
--- a/l3experimental/l3color/l3color.dtx
+++ b/l3experimental/l3color/l3color.dtx
@@ -266,10 +266,14 @@
 %
 % Valid export targets are
 % \begin{itemize}
-%    \item \texttt{HTML} Uppercase two-digit hexadecimal values, expressing
-%      a red-green-blue color; the digits are \emph{not} separated
 %    \item \texttt{annotation} Space-separated red-green-blue values
 %      suitable for use as a PDF annotation color
+%    \item \texttt{backend} Two brace groups: the first containing the
+%      model, the second containing space-separated values appropriate
+%      for the model; this is the format required by backend functions
+%      of \pkg{expl3}
+%    \item \texttt{HTML} Uppercase two-digit hexadecimal values, expressing
+%      a red-green-blue color; the digits are \emph{not} separated
 % \end{itemize}
 %
 % \begin{function}{\color_export:nnN}
@@ -1010,6 +1014,14 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{\@@_export_format_backend:nnN}
+%   Simple.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_export_format_backend:nnN #1#2#3
+  { \tl_set:Nn #3 { {#1} {#2} } }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\@@_export_format_annotation:nnN, \@@_export_format_HTML:nnN}
 % \begin{macro}{\@@_export_rgb:nnNN}
 % \begin{macro}{\@@_export_annotation:Nw, \@@_export_HTML:Nw}
diff --git a/l3experimental/l3color/testfiles/m3color002.lvt b/l3experimental/l3color/testfiles/m3color002.lvt
index 471c839f3..8cd86cc89 100644
--- a/l3experimental/l3color/testfiles/m3color002.lvt
+++ b/l3experimental/l3color/testfiles/m3color002.lvt
@@ -54,7 +54,7 @@
 \TEST { Exporting~colors }
   {
     \clist_map_inline:nn
-      { annotation , HTML }
+      { annotation , backend , HTML }
       {
         \color_export:nnN { blue } {#1} \l_tmpa_tl
         \tl_show:N \l_tmpa_tl
diff --git a/l3experimental/l3color/testfiles/m3color002.tlg b/l3experimental/l3color/testfiles/m3color002.tlg
index d44e881cd..a765e20c1 100644
--- a/l3experimental/l3color/testfiles/m3color002.tlg
+++ b/l3experimental/l3color/testfiles/m3color002.tlg
@@ -81,6 +81,18 @@ l. ...  }
 > \l_tmpa_tl=0.6 0.6 0.6.
 <recently read> }
 l. ...  }
+> \l_tmpa_tl={rgb}{0.0 0.0 1.0}.
+<recently read> }
+l. ...  }
+> \l_tmpa_tl={rgb}{0.5 0 0.5}.
+<recently read> }
+l. ...  }
+> \l_tmpa_tl={cmyk}{1.0 0.0 0.0 0.0}.
+<recently read> }
+l. ...  }
+> \l_tmpa_tl={gray}{0.6}.
+<recently read> }
+l. ...  }
 > \l_tmpa_tl=0000FF.
 <recently read> }
 l. ...  }
diff --git a/l3experimental/l3draw/l3draw-state.dtx b/l3experimental/l3draw/l3draw-state.dtx
index 2a511957e..c53cd93ab 100644
--- a/l3experimental/l3draw/l3draw-state.dtx
+++ b/l3experimental/l3draw/l3draw-state.dtx
@@ -167,7 +167,7 @@
   { \@@_color:nn { stroke } {#1} }
 \cs_new_protected:Npn \@@_color:nn #1#2
   {
-    \color_parse:nN {#2} \l_@@_color_tmp_tl
+    \color_export:nnN {#2} { backend } \l_@@_color_tmp_tl
     \exp_after:wN \@@_color:nnn \l_@@_color_tmp_tl {#1}
   }
 \cs_new_protected:Npn \@@_color:nnn #1#2#3





More information about the latex3-commits mailing list.