[latex3-commits] [git/LaTeX3-latex3-xcolor] testl3color: handle selectcolor and cmy model (9168b9c)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Aug 16 15:59:24 CEST 2022


Repository : https://github.com/latex3/xcolor
On branch  : testl3color
Link       : https://github.com/latex3/xcolor/commit/9168b9cf9634d64f1dc58bb3f39e6b7a864e502e

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

commit 9168b9cf9634d64f1dc58bb3f39e6b7a864e502e
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Aug 16 15:59:24 2022 +0200

    handle selectcolor and cmy model


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

9168b9cf9634d64f1dc58bb3f39e6b7a864e502e
 xcolor.dtx | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/xcolor.dtx b/xcolor.dtx
index ed528b9..f8979af 100644
--- a/xcolor.dtx
+++ b/xcolor.dtx
@@ -3855,22 +3855,38 @@
 % \subsubsection{Color model selection}
 %
 % \begin{macro}{\selectcolormodel}
+% \begin{macro}{\XC at expl@setcolormodel at n}
 %   \marg{num model}\\
 % Determines the target model for color definitions with |\definecolor| and friends.
+% The command sets also the target model for l3colors.
 %    \begin{macrocode}
 \def\selectcolormodel#1%
  {\@ifundefined{XC at mod@#1}%
    {\c at lor@error{target model `#1'}}%
    {\expandafter\ifx\csname XC at mod@#1\endcsname\XC at mod@natural
       \def\XC at tgt@mod##1{##1}\convertcolorsDfalse\convertcolorsUfalse
+      \XC at expl@setcolormodel at n {natural}%
     \else\expandafter\ifx\csname XC at mod@#1\endcsname\XC at mod@named
       \c at lor@error{target model `#1'}
     \else
       \edef\XC at tgt@mod##1{#1}\convertcolorsDtrue\convertcolorsUtrue
+      \XC at expl@setcolormodel at n {#1}%
     \fi\fi}}
+\ExplSyntaxOn
+\cs_set_protected:Npn \XC at expl@setcolormodel at n #1
+  {
+    \str_if_eq:nnTF {#1} { natural }
+      {
+        \tl_set:Nn \l_color_fixed_model_tl {}
+      }
+      {
+        \tl_set:Nn \l_color_fixed_model_tl { #1 }
+      }
+  }
+\ExplSyntaxOff
 %    \end{macrocode}
 % \end{macro}
-%
+% \end{macro}
 % \begin{macro}{\XC at mod@Hsb}
 % \begin{macro}{\XC at mod@tHsb}
 % \begin{macro}{\XC at mod@ignore}
@@ -4828,7 +4844,16 @@
 % We want to define colors also for l3color.
 %    \begin{macrocode}
 \ExplSyntaxOn
-\cs_set_eq:NN \XC at expl@color at set@@nnn \color_set:nnn
+\cs_set_protected:Npn \XC at expl@color at set@@nnn #1#2#3
+ {
+   \str_if_eq:nnTF {#2}{ cmy }
+    {
+      \color_set:nnn{#1}{ cmyk }{#3,0}
+    }
+    {
+      \color_set:nnn{#1}{#2}{#3}
+    }
+ }
 \cs_set_eq:NN \XC at expl@color at set@@nn \color_set:nn
 \ExplSyntaxOff
 %    \end{macrocode}





More information about the latex3-commits mailing list.