From a4ccc84b5ea15905a51f24c56989a29267cfd949 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Sat, 13 Nov 2021 03:01:22 +0000
Subject: CTAN sync 202111130301

---
 macros/latex/contrib/l3kernel/l3color.dtx | 50 +++++++++++++++++--------------
 1 file changed, 27 insertions(+), 23 deletions(-)

(limited to 'macros/latex/contrib/l3kernel/l3color.dtx')

diff --git a/macros/latex/contrib/l3kernel/l3color.dtx b/macros/latex/contrib/l3kernel/l3color.dtx
index cef2e7bef1..b3f10132d3 100644
--- a/macros/latex/contrib/l3kernel/l3color.dtx
+++ b/macros/latex/contrib/l3kernel/l3color.dtx
@@ -43,7 +43,7 @@
 %    }^^A
 % }
 %
-% \date{Released 2021-10-18}
+% \date{Released 2021-11-12}
 %
 % \maketitle
 %
@@ -654,20 +654,20 @@
     \tl_set:Nx #4
       {
         \cs_if_exist:cTF { @@_convert_ #1 _ #2 :w }
-          { \use:c { @@_convert_ #1 _ #2 :w } #3 ~ 0 ~ 0 ~ 0 \s_@@_stop }
+          { \use:c { @@_convert_ #1 _ #2 :w } #3 \s_@@_stop }
           { \use:c { c_@@_fallback_ #2 _tl } }
       }
   }
 \cs_generate_variant:Nn \@@_convert:nnnN { nV , nnV }
-\cs_new:Npn \@@_convert_gray_rgb:w #1 ~ #2 \s_@@_stop
+\cs_new:Npn \@@_convert_gray_rgb:w #1 \s_@@_stop
   { #1 ~ #1 ~ #1 }
-\cs_new:Npn \@@_convert_gray_cmyk:w #1 ~ #2 \s_@@_stop
+\cs_new:Npn \@@_convert_gray_cmyk:w #1 \s_@@_stop
   { 0 ~ 0 ~ 0 ~ \fp_eval:n { 1 - #1 } }
 %    \end{macrocode}
 %   These rather odd values are based on \textsc{ntsc} television: the set are
 %   used for the |cmyk| conversion.
 %    \begin{macrocode}
-\cs_new:Npn \@@_convert_rgb_gray:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
+\cs_new:Npn \@@_convert_rgb_gray:w #1 ~ #2 ~ #3 \s_@@_stop
   { \fp_eval:n { 0.3 * #1 + 0.59 * #2 + 0.11 * #3 } }
 %    \end{macrocode}
 %   The conversion from |rgb| to |cmyk| is the most complex: a two-step
@@ -677,7 +677,7 @@
 %   Moreover, as the likelihood of anyone using a non-unitary matrix here is
 %   tiny, we simplify and treat those two concepts as no-ops.
 %    \begin{macrocode}
-\cs_new:Npn \@@_convert_rgb_cmyk:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
+\cs_new:Npn \@@_convert_rgb_cmyk:w #1 ~ #2 ~ #3 \s_@@_stop
   {
     \exp_args:Nf \@@_convert_rgb_cmyk:nnnn
       { \fp_eval:n { min ( 1 - #1 , 1 - #2 , 1 - #3 ) } } {#1} {#2} {#3}
@@ -689,9 +689,9 @@
     \fp_eval:n { min ( 1 , max ( 0 , 1 - #4 - #1 ) ) } \c_space_tl
     #1
   }
-\cs_new:Npn \@@_convert_cmyk_gray:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \s_@@_stop
+\cs_new:Npn \@@_convert_cmyk_gray:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
   { \fp_eval:n { 1 - min ( 1 , 0.3 * #1 + 0.59 * #2 + 0.11 * #3 + #4 ) } }
-\cs_new:Npn \@@_convert_cmyk_rgb:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \s_@@_stop
+\cs_new:Npn \@@_convert_cmyk_rgb:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop
   {
     \fp_eval:n { 1 - min ( 1 , #1 + #4 ) } \c_space_tl
     \fp_eval:n { 1 - min ( 1 , #2 + #4 ) } \c_space_tl
@@ -1664,7 +1664,10 @@
   {
     \fp_compare:nNnTF {#1} = { 0 }
       { 00 }
-      { \int_to_Hex:n { \fp_to_int:n { #1 * 255 } } }
+      {
+        \fp_compare:nNnT { #1 * 255 } < { 16 } { 0 }
+        \int_to_Hex:n { \fp_to_int:n { #1 * 255 } }
+      }
   }
 \cs_new_protected:cpn { @@_export_space-sep-rgb:Nw } #1#2 \s_@@_stop
   { \tl_set:Nn #1 {#2} }
@@ -1930,7 +1933,7 @@
   }
 \cs_new_protected:Npn \@@_model_separation_cmyk:nnnnnn #1#2#3#4#5#6
   {
-    \cs_new:cpn { @@_convert_ #1 _cmyk:w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpn { @@_convert_ #1 _cmyk:w } ##1 \s_@@_stop
       {
          \fp_eval:n {##1 * #3} ~
          \fp_eval:n {##1 * #4} ~
@@ -1945,7 +1948,7 @@
   }
 \cs_new_protected:Npn \@@_model_separation_rgb:nnnnnn #1#2#3#4#5#6
   {
-    \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 \s_@@_stop
       {
          \fp_eval:n {##1 * #3} ~
          \fp_eval:n {##1 * #4} ~
@@ -1959,16 +1962,16 @@
   }
 \cs_new_protected:Npn \@@_model_separation_gray:nnnnnn #1#2#3#4#5#6
   {
-    \cs_new:cpn { @@_convert_ #1 _cmyk:w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpn { @@_convert_ #1 _cmyk:w } ##1 \s_@@_stop
       {
         \fp_eval:n {##1 * #3} ~
         \fp_eval:n {##1 * #3} ~
         \fp_eval:n {##1 * #3} ~
         \fp_eval:n {##1 * #3}
       }
-    \cs_new:cpn { @@_convert_ #1 _gray:w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpn { @@_convert_ #1 _gray:w } ##1 \s_@@_stop
       { \fp_eval:n {##1 * #3} }
-    \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpn { @@_convert_ #1 _rgb:w } ##1 \s_@@_stop
       {
         \fp_eval:n {##1 * #3} ~
         \fp_eval:n {##1 * #3} ~
@@ -1982,11 +1985,11 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_model_convert:nnn #1#2#3
   {
-    \cs_new:cpx { @@_convert_ #1 _ #3 :w } ##1 ~ ##2 \s_@@_stop
+    \cs_new:cpx { @@_convert_ #1 _ #3 :w } ##1 \s_@@_stop
       {
         \exp_not:N \exp_args:NNe \exp_not:N \use:nn
         \exp_not:c { @@_convert_  #2 _ #3 :w }
-          { \exp_not:c { @@_convert_ #1 _ #2 :w } ##1 ~ ##2 \s_@@_stop }
+          { \exp_not:c { @@_convert_ #1 _ #2 :w } ##1 \s_@@_stop }
           \c_space_tl \exp_not:N \s_@@_stop
       }
   }
@@ -2018,11 +2021,11 @@
     \tl_if_exist:cTF { c_@@_model_whitepoint_CIELAB_ #1 _tl }
       {
         \@@_backend_separation_init_CIELAB:nnn {#1} {#3} { #4 ~ #5 ~ #6 }
-        \cs_new:cpn { @@_convert_ #2 _cmyk:w } ##1 ~ ##2 \s_@@_stop
+        \cs_new:cpn { @@_convert_ #2 _cmyk:w } ##1 \s_@@_stop
           { 0 ~ 0 ~ 0 ~ 1 }
-        \cs_new:cpn { @@_convert_ #2 _rgb:w } ##1 ~ ##2 \s_@@_stop
+        \cs_new:cpn { @@_convert_ #2 _rgb:w } ##1 \s_@@_stop
           { 1 ~ 1 ~ 1 }
-        \cs_new:cpn { @@_convert_ #2 _gray:w } ##1 ~ ##2 \s_@@_stop
+        \cs_new:cpn { @@_convert_ #2 _gray:w } ##1 \s_@@_stop
           { 1 }
       }
       {
@@ -2311,7 +2314,7 @@
         \prop_get:NnN \g_@@_alternative_values_prop {##1}
           \l_@@_value_tl
         \exp_after:wN \@@_model_devicen_transform:w
-          \l_@@_value_tl , 0 , 0 , 0 \s_@@_stop {#1} {#2}
+          \l_@@_value_tl , 0 , 0 , 0 , \s_@@_stop {#1} {#2}
       }
     \tl_put_right:Nx \l_@@_internal_tl
       {
@@ -2349,7 +2352,7 @@
   { \@@_model_devicen_transform:nnn {#5} { 1 } {#1} }
 \cs_new_protected:cpn { @@_model_devicen_transform_3:nnnnn } #1#2#3#4#5
   {
-    \clist_map_inline { #1 , #2 , #3 }
+    \clist_map_inline:nn { #1 , #2 , #3 }
       { \@@_model_devicen_transform:nnn {#5} { 3 } {##1} }
   }
 \cs_new_protected:cpn { @@_model_devicen_transform_4:nnnnn } #1#2#3#4#5
@@ -2407,8 +2410,9 @@
       {
         \exp_not:c { @@_convert_devicen_ #2 : \prg_replicate:nn {#3} { n } w }
           \prg_replicate:nn {#3} { { 1 } }
-          ##1 \exp_not:N \s_@@_mark
+          ##1 ~ \exp_not:N \s_@@_mark
           \clist_map_function:nN {#4} \@@_model_devicen_convert:n
+          {}
           \exp_not:N \s_@@_stop
       }
   }
@@ -2490,7 +2494,7 @@
 \cs_new:Npn \@@_convert_devicen_rgb:nnnw
   #1#2#3#4 ~ #5 \s_@@_mark #6#7 \s_@@_stop
   {
-    \@@_convert_devicen_cmyk:nnnnnn {#4} {#1} {#2} {#3} #6
+    \@@_convert_devicen_rgb:nnnnnnn {#4} {#1} {#2} {#3} #6
       #5 \s_@@_mark #7 \s_@@_stop
   }
 \cs_new:Npn \@@_convert_devicen_rgb:nnnnnnn #1#2#3#4#5#6#7
-- 
cgit v1.2.3

