[latex3-commits] [git/LaTeX3-latex3-latex3] color-multi-model: Add support for multiple color models (see #739) (24bb8333c)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Jun 15 17:46:37 CEST 2020


Repository : https://github.com/latex3/latex3
On branch  : color-multi-model
Link       : https://github.com/latex3/latex3/commit/24bb8333cf491f49c918d737b7a9916de4222511

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

commit 24bb8333cf491f49c918d737b7a9916de4222511
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Jun 15 11:34:13 2020 +0100

    Add support for multiple color models (see #739)


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

24bb8333cf491f49c918d737b7a9916de4222511
 l3backend/l3backend-color.dtx                      |  31 ++---
 l3experimental/CHANGELOG.md                        |   1 +
 l3experimental/l3color/l3color.dtx                 | 152 +++++++++++++++++----
 .../l3color/testfiles/m3color001.ptex.tlg          |   3 +
 l3experimental/l3color/testfiles/m3color001.tlg    |   3 +
 .../l3color/testfiles/m3color001.uptex.tlg         |   3 +
 .../l3color/testfiles/m3color001.xetex.tlg         |   3 +
 l3experimental/l3color/testfiles/m3color002.tlg    |   2 +
 l3experimental/l3color/testfiles/m3color003.lvt    |  82 +++++++++++
 .../l3color/testfiles/m3color003.ptex.tlg          | 100 ++++++++++++++
 l3experimental/l3color/testfiles/m3color003.tlg    |  95 +++++++++++++
 .../l3color/testfiles/m3color003.uptex.tlg         | 100 ++++++++++++++
 .../l3color/testfiles/m3color003.xetex.tlg         |  95 +++++++++++++
 13 files changed, 625 insertions(+), 45 deletions(-)

diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index 2f7737006..bec4c4882 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -111,11 +111,14 @@
 % \end{macro}
 % \end{macro}
 %
-% \begin{macro}{\@@_backend_cmyk:n}
-% \begin{macro}{\@@_backend_gray:n}
-% \begin{macro}{\@@_backend_rgb:n}
-% \begin{macro}{\@@_backend_spot:n}
-% \begin{macro}{\@@_backend_select:n}
+% \begin{macro}
+%   {
+%     \@@_backend_cmyk:n  ,
+%     \@@_backend_gray:n  ,
+%     \@@_backend_rgb:n   ,
+%     \@@_backend_spot:n  ,
+%     \@@_backend_select:n
+%   }
 % \begin{macro}{\@@_backend_reset:}
 % \begin{macro}{color.fc}
 %    Push the data to the stack. In the case of \texttt{dvips} also reset the
@@ -143,10 +146,6 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 %
 %    \begin{macrocode}
 %</dvisvgm|dvipdfmx|dvips|xdvipdfmx>
@@ -216,10 +215,13 @@
 %    \end{macrocode}
 % \end{variable}
 %
-% \begin{macro}{\@@_backend_cmyk:n}
-% \begin{macro}{\@@_backend_gray:n}
-% \begin{macro}{\@@_backend_rgb:n}
-% \begin{macro}{\@@_backend_spot:n}
+% \begin{macro}
+%   {
+%     \@@_backend_cmyk:n ,
+%     \@@_backend_gray:n ,
+%     \@@_backend_rgb:n  ,
+%     \@@_backend_spot:n
+%   }
 % \begin{macro}{\@@_backend_spot:w}
 % \begin{macro}{\@@_backend_select:n}
 % \begin{macro}{\@@_backend_reset:}
@@ -255,9 +257,6 @@
 % \end{macro}
 % \end{macro}
 % \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 %
 %    \begin{macrocode}
 %</pdfmode>
diff --git a/l3experimental/CHANGELOG.md b/l3experimental/CHANGELOG.md
index e794d24cf..34d213323 100644
--- a/l3experimental/CHANGELOG.md
+++ b/l3experimental/CHANGELOG.md
@@ -9,6 +9,7 @@ this project uses date-based 'snapshot' version identifiers.
 
 ### Added
 - `\color_export:nn(n)N` (see #742)
+- Support for multiple color models
 
 ### Changed
 - Internal color model
diff --git a/l3experimental/l3color/l3color.dtx b/l3experimental/l3color/l3color.dtx
index be9a22a42..3529fd6b8 100644
--- a/l3experimental/l3color/l3color.dtx
+++ b/l3experimental/l3color/l3color.dtx
@@ -190,9 +190,9 @@
 %
 % \begin{function}{\color_set:nnn}
 %   \begin{syntax}
-%     \cs{color_set:nnn} \Arg{name} \Arg{model} \Arg{value(s)}
+%     \cs{color_set:nnn} \Arg{name} \Arg{model(s)} \Arg{value(s)}
 %   \end{syntax}
-%   Stores the color specification equivalent to the \meta{model} and
+%   Stores the color specification equivalent to the \meta{model(s)} and
 %   \meta{values} as the \meta{name}.
 % \end{function}
 %
@@ -225,9 +225,9 @@
 %
 % \begin{function}{\color_select:nn}
 %   \begin{syntax}
-%     \cs{color_select:nn} \Arg{model} \Arg{value(s)}
+%     \cs{color_select:nn} \Arg{model(s)} \Arg{value(s)}
 %   \end{syntax}
-%   Activates the color specification equivalent to the \meta{model} and
+%   Activates the color specification equivalent to the \meta{model(s)} and
 %   \meta{value(s)} for typeset material.
 % \end{function}
 %
@@ -237,6 +237,31 @@
 %   and similar are not influenced by this setting.
 % \end{variable}
 %
+% \section{Multiple color models}
+%
+% When selecting or setting a color with an explicit model, it is possible
+% to give values for more than one model at one time. This is particularly
+% useful where automated conversion between models does not give the desired
+% outcome. To do this, the list of models and list of values are both subdivided
+% using |/| characters (as for the similar function in \pkg{xcolor}). For
+% example, to save a color with explicit |cmyk| and |rgb| values, one could
+% use
+% \begin{verbatim}
+%   \color_set:nnn { foo } { cmyk / rgb }
+%     { 0.1 , 0.2 , 0.3 , 0.4 / 0.1, 0.2 , 0.3 }
+% \end{verbatim}
+% The manually-specified conversion will be used in preference to automated
+% calculation whenever the model(s) listed are used: both in expressions and
+% when a fixed model is active.
+% 
+% Similarly, the same syntax can be applied to directly selecting a color.
+% \begin{verbatim}
+%   \color_select:nn { cmyk / rgb }
+%     { 0.1 , 0.2 , 0.3 , 0.4 / 0.1, 0.2 , 0.3 }
+% \end{verbatim}
+% Again, this list is used when a fixed model is active: the first entry is used
+% unless there is a fixed model matching one of the other entries.
+%
 % \section{Exporting color specifications}
 %
 % The major use of color expressions is in setting typesetting output, but there
@@ -379,7 +404,7 @@
 % \subsection{Model conversion}
 %
 % \begin{macro}{\@@_convert:nnN, \@@_convert:VVN}
-% \begin{macro}{\@@_convert:nnnN}
+% \begin{macro}{\@@_convert:nnnN, \@@_convert:nVnN, \@@_convert:nnVN}
 % \begin{macro}[aux, EXP]
 %   {
 %     \@@_convert_gray_rgb:w
@@ -404,7 +429,7 @@
     \tl_set:Nx #4
       { \use:c { @@_convert_ #1 _ #2 :w } #3 ~ 0 ~ 0 ~ 0 \s_@@_stop }
   }
-\cs_generate_variant:Nn \@@_convert:nnnN { nnV }
+\cs_generate_variant:Nn \@@_convert:nnnN { nV , nnV }
 \cs_new:Npn \@@_convert_gray_rgb:w #1 ~ #2 \s_@@_stop
   { #1 ~ #1 ~ #1 }
 \cs_new:Npn \@@_convert_gray_cmyk:w #1 ~ #2 \s_@@_stop
@@ -597,10 +622,15 @@
                       { \l_@@_value_tl }
                   }
               }
-            \@@_convert:VVN
-              \l_@@_next_model_tl
+            \prop_get:cVNF { l_@@_named_ #2 _prop }
               \l_@@_model_tl
               \l_@@_next_value_tl
+              {
+                \@@_convert:VVN
+                  \l_@@_next_model_tl
+                  \l_@@_model_tl
+                  \l_@@_next_value_tl
+              }
           }
         \tl_set:Nx \l_@@_value_tl
           {
@@ -845,8 +875,13 @@
 %
 % \begin{macro}{\color_select:n}
 % \begin{macro}{\color_select:nn}
+% \begin{macro}{\@@_select_main:Nw, \@@_select_loop:Nw}
+% \begin{macro}{\@@_select:nnN}
+% \begin{macro}{\@@_select_swap:Nnn}
 %   Parse the input expressions then get the backend to actually activate
-%   them.
+%   them. The main complexity here is the need to check through multiple models.
+%   That is done \enquote{locally} here as the approach is subtly different to
+%   when different models are being stored.
 %    \begin{macrocode}
 \cs_new_protected:Npn \color_select:n #1
   {
@@ -855,32 +890,61 @@
   }
 \cs_new_protected:Npn \color_select:nn #1#2
   {
-    \@@_direct:nnN {#1} {#2} \l_@@_current_tl
+    \@@_select_main:Nw \l_@@_current_tl
+      #1 / / \s_@@_mark #2 / / \s_@@_stop
     \@@_select:
   }
 %    \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Direct model use}
-%
-% \begin{macro}{\@@_direct:nnN}
-%   Directly set a color based on a model/value combination.
+%   If the first color model is the fixed one, or if there is no fixed
+%   model, we don't need most of the data: just set up and apply the backend
+%   function.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_select_main:Nw
+  #1 #2 / #3 / #4 \s_@@_mark #5 / #6 / #7 \s_@@_stop
+  {
+    \@@_select:nnN {#2} {#5} #1
+    \bool_lazy_or:nnF
+      { \tl_if_empty_p:N \l_color_fixed_model_tl }
+      { \str_if_eq_p:nV {#2} \l_color_fixed_model_tl }
+      { \@@_select_loop:Nw #1 #3 / #4 \s_@@_mark #6 / #7 \s_@@_stop }
+  }
+%    \end{macrocode}
+%   If a fixed model applies, we need to check each possible value in order.
+%   If there is no hit at all, fall back on the generic formula-based
+%   interchange.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_direct:nnN #1#2#3
+\cs_new_protected:Npn \@@_select_loop:Nw
+  #1 #2 / #3 \s_@@_mark #4 / #5 \s_@@_stop
+  {
+    \str_if_eq:nVTF {#2} \l_color_fixed_model_tl
+      { \@@_select:nnN {#2} {#4} #1 }
+      {
+        \tl_if_blank:nTF {#2}
+          { \exp_after:wN \@@_select_swap:Nnn \exp_after:wN #1 #1 }
+          { \@@_select_loop:Nw #1 #3 \s_@@_mark #5 \s_@@_stop }
+      }
+  }
+\cs_new_protected:Npn \@@_select:nnN #1#2#3
   {
     \cs_if_exist:cTF { @@_parse_model_ #1 :w }
       {
         \tl_set:Nx #3
           { \use:c { @@_parse_model_ #1 :w } #2 , 0 , 0 , 0 , 0 \s_@@_stop }
-        \@@_check_model:N #3
-      }
-      {
-        \__kernel_msg_error:nnn { color } { unknown-model } {#1}
       }
+      { \__kernel_msg_error:nnn { color } { unknown-model } {#1} }
+  }
+\cs_new_protected:Npn \@@_select_swap:Nnn #1#2#3
+  {
+    \@@_convert:nVnN {#2} \l_color_fixed_model_tl {#3} \l_@@_value_tl
+    \tl_set:Nx #1
+      { { \l_color_fixed_model_tl } { \l_@@_value_tl } }
   }
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
 %
 % \subsection{Defining named colors}
 %
@@ -907,9 +971,13 @@
 %
 % \begin{macro}{\color_set:nn}
 % \begin{macro}{\color_set:nnn}
+% \begin{macro}{\@@_set:nw}
+% \begin{macro}{\@@_set_loop:nw}
 % \begin{macro}{\color_set_eq:nn}
-%   Defining named colors has to include a step to force creation of the
-%   underlying token list to avoid errors when checking is enabled.
+%   Defining named colors means working through the model list and saving
+%   both the \enquote{main} color and any equivalents in other models. Even
+%   if there is only one model, we store a |prop| as well as a |tl|, as there
+%   could be grouping weirdness, etc.
 %    \begin{macrocode}
 \cs_new_protected:Npn \color_set:nn #1#2
   {
@@ -917,9 +985,27 @@
     \@@_store:Nn \l_@@_named_tl {#1}
   }
 \cs_new_protected:Npn \color_set:nnn #1#2#3
+  { \@@_set:nw {#1} #2 / / \s_@@_mark #3 / / \s_@@_stop }
+\cs_new_protected:Npn \@@_set:nw
+  #1#2 / #3 / #4 \s_@@_mark #5 / #6 / #7 \s_@@_stop
   {
-    \@@_direct:nnN {#2} {#3} \l_@@_named_tl
+    \@@_select:nnN {#2} {#5} \l_@@_named_tl
     \@@_store:Nn \l_@@_named_tl {#1}
+    \prop_clear_new:c { l_@@_named_ #1 _prop }
+    \prop_put:cnx { l_@@_named_ #1 _prop } {#2}
+      { \exp_after:wN \use_ii:nn \l_@@_named_tl }
+    \@@_set_loop:nw {#1} #3 / #4 \s_@@_mark #6 / #7 \s_@@_stop
+  }
+\cs_new_protected:Npn \@@_set_loop:nw
+  #1#2 / #3 \s_@@_mark #4 / #5 \s_@@_stop
+  {
+    \tl_if_blank:nF {#2}
+      {
+        \@@_select:nnN {#2} {#4} \l_@@_named_tl
+        \prop_put:cnx { l_@@_named_ #1 _prop } {#2}
+          { \exp_after:wN \use_ii:nn \l_@@_named_tl }
+        \@@_set_loop:nw {#1} #3 \s_@@_mark #5 \s_@@_stop
+      }
   }
 \cs_new_protected:Npn \color_set_eq:nn #1#2
   {
@@ -977,7 +1063,8 @@
   }
 \cs_new_protected:Npn \color_export:nnnN #1#2#3#4
   {
-    \@@_direct:nnN {#1} {#2} #4
+    \@@_select_main:Nw #4
+      #1 / / \s_@@_mark #2 / / \s_@@_stop
     \@@_export:nN {#3} #4
   }
 \cs_new_protected:Npn \@@_export:nN #1#2
@@ -1090,9 +1177,16 @@
     \msg_show:nnxxxx { LaTeX / color } { show }
       {#1}
       {
-        \@@_if_defined:nTF {#1}
-          { \exp_last_unbraced:Nv \@@_show:nn { l_@@_named_ #1 _tl } }
-          { }
+        \@@_if_defined:nT {#1}
+          {
+            \exp_last_unbraced:Nv \@@_show:nn { l_@@_named_ #1 _tl }
+            \int_compare:nNnT { \prop_count:c { l_@@_named_ #1 _prop } } > 1
+              {
+                \prop_map_function:cN
+                  { l_@@_named_ #1 _prop }
+                  \msg_show_item_unbraced:nn
+              }
+          }
       }
       { }
       { }
diff --git a/l3experimental/l3color/testfiles/m3color001.ptex.tlg b/l3experimental/l3color/testfiles/m3color001.ptex.tlg
index 28706274e..4cebd6bbe 100644
--- a/l3experimental/l3color/testfiles/m3color001.ptex.tlg
+++ b/l3experimental/l3color/testfiles/m3color001.ptex.tlg
@@ -5,18 +5,21 @@ Author: Joseph Wright
 TEST 1: Naming colors by model
 ============================================================
 Defining \l__color_named_foo1_tl on line ...
+Defining \l__color_named_foo1_prop on line ...
 The color foo1 has the properties:
 >  model  =>  gray
 >  value  =>  0.1.
 <recently read> }
 l. ...  }
 Defining \l__color_named_foo2_tl on line ...
+Defining \l__color_named_foo2_prop on line ...
 The color foo2 has the properties:
 >  model  =>  rgb
 >  value  =>  0.1 0.2 0.3.
 <recently read> }
 l. ...  }
 Defining \l__color_named_foo3_tl on line ...
+Defining \l__color_named_foo3_prop on line ...
 The color foo3 has the properties:
 >  model  =>  cmyk
 >  value  =>  0.1 0.2 0.3 0.4.
diff --git a/l3experimental/l3color/testfiles/m3color001.tlg b/l3experimental/l3color/testfiles/m3color001.tlg
index 42a2306a4..ac124037d 100644
--- a/l3experimental/l3color/testfiles/m3color001.tlg
+++ b/l3experimental/l3color/testfiles/m3color001.tlg
@@ -5,18 +5,21 @@ Author: Joseph Wright
 TEST 1: Naming colors by model
 ============================================================
 Defining \l__color_named_foo1_tl on line ...
+Defining \l__color_named_foo1_prop on line ...
 The color foo1 has the properties:
 >  model  =>  gray
 >  value  =>  0.1.
 <recently read> }
 l. ...  }
 Defining \l__color_named_foo2_tl on line ...
+Defining \l__color_named_foo2_prop on line ...
 The color foo2 has the properties:
 >  model  =>  rgb
 >  value  =>  0.1 0.2 0.3.
 <recently read> }
 l. ...  }
 Defining \l__color_named_foo3_tl on line ...
+Defining \l__color_named_foo3_prop on line ...
 The color foo3 has the properties:
 >  model  =>  cmyk
 >  value  =>  0.1 0.2 0.3 0.4.
diff --git a/l3experimental/l3color/testfiles/m3color001.uptex.tlg b/l3experimental/l3color/testfiles/m3color001.uptex.tlg
index 28706274e..4cebd6bbe 100644
--- a/l3experimental/l3color/testfiles/m3color001.uptex.tlg
+++ b/l3experimental/l3color/testfiles/m3color001.uptex.tlg
@@ -5,18 +5,21 @@ Author: Joseph Wright
 TEST 1: Naming colors by model
 ============================================================
 Defining \l__color_named_foo1_tl on line ...
+Defining \l__color_named_foo1_prop on line ...
 The color foo1 has the properties:
 >  model  =>  gray
 >  value  =>  0.1.
 <recently read> }
 l. ...  }
 Defining \l__color_named_foo2_tl on line ...
+Defining \l__color_named_foo2_prop on line ...
 The color foo2 has the properties:
 >  model  =>  rgb
 >  value  =>  0.1 0.2 0.3.
 <recently read> }
 l. ...  }
 Defining \l__color_named_foo3_tl on line ...
+Defining \l__color_named_foo3_prop on line ...
 The color foo3 has the properties:
 >  model  =>  cmyk
 >  value  =>  0.1 0.2 0.3 0.4.
diff --git a/l3experimental/l3color/testfiles/m3color001.xetex.tlg b/l3experimental/l3color/testfiles/m3color001.xetex.tlg
index 1e8fb9788..de9eb992a 100644
--- a/l3experimental/l3color/testfiles/m3color001.xetex.tlg
+++ b/l3experimental/l3color/testfiles/m3color001.xetex.tlg
@@ -5,18 +5,21 @@ Author: Joseph Wright
 TEST 1: Naming colors by model
 ============================================================
 Defining \l__color_named_foo1_tl on line ...
+Defining \l__color_named_foo1_prop on line ...
 The color foo1 has the properties:
 >  model  =>  gray
 >  value  =>  0.1.
 <recently read> }
 l. ...  }
 Defining \l__color_named_foo2_tl on line ...
+Defining \l__color_named_foo2_prop on line ...
 The color foo2 has the properties:
 >  model  =>  rgb
 >  value  =>  0.1 0.2 0.3.
 <recently read> }
 l. ...  }
 Defining \l__color_named_foo3_tl on line ...
+Defining \l__color_named_foo3_prop on line ...
 The color foo3 has the properties:
 >  model  =>  cmyk
 >  value  =>  0.1 0.2 0.3 0.4.
diff --git a/l3experimental/l3color/testfiles/m3color002.tlg b/l3experimental/l3color/testfiles/m3color002.tlg
index cd750a052..b59de9b3f 100644
--- a/l3experimental/l3color/testfiles/m3color002.tlg
+++ b/l3experimental/l3color/testfiles/m3color002.tlg
@@ -5,6 +5,7 @@ Author: Joseph Wright
 TEST 1: Hsb model
 ============================================================
 Defining \l__color_named_foo1_tl on line ...
+Defining \l__color_named_foo1_prop on line ...
 The color foo1 has the properties:
 >  model  =>  rgb
 >  value  =>  0.7 0.315 0.28.
@@ -60,6 +61,7 @@ The color foo1 has the properties:
 <recently read> }
 l. ...  }
 Defining \l__color_named_foo2_tl on line ...
+Defining \l__color_named_foo2_prop on line ...
 The color foo2 has the properties:
 >  model  =>  rgb
 >  value  =>  0.07059 0.20392 0.68235.
diff --git a/l3experimental/l3color/testfiles/m3color003.lvt b/l3experimental/l3color/testfiles/m3color003.lvt
new file mode 100644
index 000000000..a630bd159
--- /dev/null
+++ b/l3experimental/l3color/testfiles/m3color003.lvt
@@ -0,0 +1,82 @@
+%
+% Copyright (C) 2020 The LaTeX3 Project
+%
+
+\documentclass{minimal}
+
+\input{regression-test}
+
+\RequirePackage[enable-debug]{expl3}
+\RequirePackage{l3color}
+\ExplSyntaxOn
+\debug_on:n { check-declarations , deprecation , log-functions }
+\ExplSyntaxOff
+
+\START
+
+\AUTHOR{Joseph Wright}
+
+\ExplSyntaxOn
+
+\OMIT
+  \cs_set_protected:Npn \test:n #1
+    {
+      \hbox_set:Nn \l_tmpa_box
+        {
+          \group_begin:
+            #1
+            Hello
+          \group_end:
+        }
+      \box_show:N \l_tmpa_box
+    }
+\TIMO
+
+\TEST { Multiple~models:~selecting }
+  {
+    \test:n { \color_select:nn { gray / rgb } { 0.1 / 0.1 , 0.1 , 0.2 } }
+    \group_begin:
+      \tl_set:Nn \l_color_fixed_model_tl { rgb }
+      \test:n { \color_select:nn { gray / rgb } { 0.1 / 0.1 , 0.1 , 0.2 } }
+    \group_end:
+    \test:n
+      {
+        \color_select:nn { rgb / cmyk }
+          { 0.1 , 0.2 , 0.3 / 0.1 , 0.2 , 0.3 , 0.4 }
+      }
+    \group_begin:
+      \tl_set:Nn \l_color_fixed_model_tl { cmyk }
+      \test:n
+         {
+           \color_select:nn { rgb / cmyk }
+             { 0.1 , 0.2 , 0.3 / 0.1 , 0.2 , 0.3 , 0.4 }
+         }
+    \group_end:
+    \group_begin:
+      \tl_set:Nn \l_color_fixed_model_tl { gray }
+      \test:n
+         {
+           \color_select:nn { rgb / cmyk }
+             { 0.1 , 0.2 , 0.3 / 0.1 , 0.2 , 0.3 , 0.4 }
+         }
+    \group_end:
+  }
+
+\TEST { Multiple~models:~named }
+  {
+    \color_set:nnn { foo1 } { cmyk / rgb }
+      { 0.1 , 0.2 , 0.3 , 0.4 / 0.1 , 0.1 , 0.2 }
+    \color_set:nn { test } { cyan!50!foo1 }
+    \color_show:n { test }
+    \color_set:nn { test } { blue!50!foo1 }
+    \color_show:n { test }
+  }
+
+\TEST { Showing~multiple~models }
+  {
+    \color_set:nnn { foo1 } { cmyk / rgb }
+      { 0.1 , 0.2 , 0.3 , 0.4 / 0.1 , 0.1 , 0.2 }
+    \color_show:n { foo1 }
+  }
+
+\END
diff --git a/l3experimental/l3color/testfiles/m3color003.ptex.tlg b/l3experimental/l3color/testfiles/m3color003.ptex.tlg
new file mode 100644
index 000000000..27771fd9e
--- /dev/null
+++ b/l3experimental/l3color/testfiles/m3color003.ptex.tlg
@@ -0,0 +1,100 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Joseph Wright
+============================================================
+TEST 1: Multiple models: selecting
+============================================================
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0.1}
+.\special{ps:SDict begin /color.fc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 0.1 0.1 0.2}
+.\special{ps:SDict begin /color.fc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 0.1 0.2 0.3}
+.\special{ps:SDict begin /color.fc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push cmyk 0.1 0.2 0.3 0.4}
+.\special{ps:SDict begin /color.fc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0.181}
+.\special{ps:SDict begin /color.fc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+============================================================
+============================================================
+TEST 2: Multiple models: named
+============================================================
+Defining \l__color_named_foo1_tl on line ...
+Defining \l__color_named_foo1_prop on line ...
+Defining \l__color_named_test_tl on line ...
+The color test has the properties:
+>  model  =>  cmyk
+>  value  =>  0.55 0.1 0.15 0.2.
+<recently read> }
+l. ...  }
+The color test has the properties:
+>  model  =>  rgb
+>  value  =>  0.05 0.05 0.6.
+<recently read> }
+l. ...  }
+============================================================
+============================================================
+TEST 3: Showing multiple models
+============================================================
+The color foo1 has the properties:
+>  model  =>  cmyk
+>  value  =>  0.1 0.2 0.3 0.4
+>  cmyk  =>  0.1 0.2 0.3 0.4
+>  rgb  =>  0.1 0.1 0.2.
+<recently read> }
+l. ...  }
+============================================================
diff --git a/l3experimental/l3color/testfiles/m3color003.tlg b/l3experimental/l3color/testfiles/m3color003.tlg
new file mode 100644
index 000000000..30372dd11
--- /dev/null
+++ b/l3experimental/l3color/testfiles/m3color003.tlg
@@ -0,0 +1,95 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Joseph Wright
+============================================================
+TEST 1: Multiple models: selecting
+============================================================
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\pdfcolorstack 0 push {0.1 g 0.1 G}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\pdfcolorstack 0 pop
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\pdfcolorstack 0 push {0.1 0.1 0.2 rg 0.1 0.1 0.2 RG}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\pdfcolorstack 0 pop
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\pdfcolorstack 0 push {0.1 0.2 0.3 rg 0.1 0.2 0.3 RG}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\pdfcolorstack 0 pop
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\pdfcolorstack 0 push {0.1 0.2 0.3 0.4 k 0.1 0.2 0.3 0.4 K}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\pdfcolorstack 0 pop
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\pdfcolorstack 0 push {0.181 g 0.181 G}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\pdfcolorstack 0 pop
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+============================================================
+============================================================
+TEST 2: Multiple models: named
+============================================================
+Defining \l__color_named_foo1_tl on line ...
+Defining \l__color_named_foo1_prop on line ...
+Defining \l__color_named_test_tl on line ...
+The color test has the properties:
+>  model  =>  cmyk
+>  value  =>  0.55 0.1 0.15 0.2.
+<recently read> }
+l. ...  }
+The color test has the properties:
+>  model  =>  rgb
+>  value  =>  0.05 0.05 0.6.
+<recently read> }
+l. ...  }
+============================================================
+============================================================
+TEST 3: Showing multiple models
+============================================================
+The color foo1 has the properties:
+>  model  =>  cmyk
+>  value  =>  0.1 0.2 0.3 0.4
+>  cmyk  =>  0.1 0.2 0.3 0.4
+>  rgb  =>  0.1 0.1 0.2.
+<recently read> }
+l. ...  }
+============================================================
diff --git a/l3experimental/l3color/testfiles/m3color003.uptex.tlg b/l3experimental/l3color/testfiles/m3color003.uptex.tlg
new file mode 100644
index 000000000..27771fd9e
--- /dev/null
+++ b/l3experimental/l3color/testfiles/m3color003.uptex.tlg
@@ -0,0 +1,100 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Joseph Wright
+============================================================
+TEST 1: Multiple models: selecting
+============================================================
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0.1}
+.\special{ps:SDict begin /color.fc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 0.1 0.1 0.2}
+.\special{ps:SDict begin /color.fc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 0.1 0.2 0.3}
+.\special{ps:SDict begin /color.fc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push cmyk 0.1 0.2 0.3 0.4}
+.\special{ps:SDict begin /color.fc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0.181}
+.\special{ps:SDict begin /color.fc {} def end}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+============================================================
+============================================================
+TEST 2: Multiple models: named
+============================================================
+Defining \l__color_named_foo1_tl on line ...
+Defining \l__color_named_foo1_prop on line ...
+Defining \l__color_named_test_tl on line ...
+The color test has the properties:
+>  model  =>  cmyk
+>  value  =>  0.55 0.1 0.15 0.2.
+<recently read> }
+l. ...  }
+The color test has the properties:
+>  model  =>  rgb
+>  value  =>  0.05 0.05 0.6.
+<recently read> }
+l. ...  }
+============================================================
+============================================================
+TEST 3: Showing multiple models
+============================================================
+The color foo1 has the properties:
+>  model  =>  cmyk
+>  value  =>  0.1 0.2 0.3 0.4
+>  cmyk  =>  0.1 0.2 0.3 0.4
+>  rgb  =>  0.1 0.1 0.2.
+<recently read> }
+l. ...  }
+============================================================
diff --git a/l3experimental/l3color/testfiles/m3color003.xetex.tlg b/l3experimental/l3color/testfiles/m3color003.xetex.tlg
new file mode 100644
index 000000000..3e2fb25a4
--- /dev/null
+++ b/l3experimental/l3color/testfiles/m3color003.xetex.tlg
@@ -0,0 +1,95 @@
+This is a generated file for the LaTeX (2e + expl3) validation system.
+Don't change this file in any respect.
+Author: Joseph Wright
+============================================================
+TEST 1: Multiple models: selecting
+============================================================
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0.1}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 0.1 0.1 0.2}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push rgb 0.1 0.2 0.3}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push cmyk 0.1 0.2 0.3 0.4}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+> \box...=
+\hbox(6.94444+0.0)x22.50005
+.\special{color push gray 0.181}
+.\OT1/cmr/m/n/10 H
+.\OT1/cmr/m/n/10 e
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 l
+.\OT1/cmr/m/n/10 o
+.\special{color pop}
+! OK.
+<argument> \l_tmpa_box 
+l. ...  }
+============================================================
+============================================================
+TEST 2: Multiple models: named
+============================================================
+Defining \l__color_named_foo1_tl on line ...
+Defining \l__color_named_foo1_prop on line ...
+Defining \l__color_named_test_tl on line ...
+The color test has the properties:
+>  model  =>  cmyk
+>  value  =>  0.55 0.1 0.15 0.2.
+<recently read> }
+l. ...  }
+The color test has the properties:
+>  model  =>  rgb
+>  value  =>  0.05 0.05 0.6.
+<recently read> }
+l. ...  }
+============================================================
+============================================================
+TEST 3: Showing multiple models
+============================================================
+The color foo1 has the properties:
+>  model  =>  cmyk
+>  value  =>  0.1 0.2 0.3 0.4
+>  cmyk  =>  0.1 0.2 0.3 0.4
+>  rgb  =>  0.1 0.1 0.2.
+<recently read> }
+l. ...  }
+============================================================





More information about the latex3-commits mailing list.