diff options
author | Norbert Preining <norbert@preining.info> | 2020-06-19 03:03:14 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-06-19 03:03:14 +0000 |
commit | fa4840ca74917d6402885b9b77c26e51b61fc68a (patch) | |
tree | efd50c9a9a8eddb4154175ae575aa5f435582a06 /macros/latex/contrib/l3experimental/l3color.dtx | |
parent | 7a78c3b8b21b6842d27bb48f37197f8c380ccc5e (diff) |
CTAN sync 202006190303
Diffstat (limited to 'macros/latex/contrib/l3experimental/l3color.dtx')
-rw-r--r-- | macros/latex/contrib/l3experimental/l3color.dtx | 113 |
1 files changed, 53 insertions, 60 deletions
diff --git a/macros/latex/contrib/l3experimental/l3color.dtx b/macros/latex/contrib/l3experimental/l3color.dtx index c7addda60b..8a87d390b4 100644 --- a/macros/latex/contrib/l3experimental/l3color.dtx +++ b/macros/latex/contrib/l3experimental/l3color.dtx @@ -46,7 +46,7 @@ % }^^A % } % -% \date{Released 2020-06-03} +% \date{Released 2020-06-18} % % \maketitle % @@ -240,20 +240,9 @@ % \section{Core color representation} % % To allow data to be handled internally, \pkg{l3color} uses a simple -% representation of color, based on that used by the \pkg{dvips} program. -% This is a token list made up of the model name followed by one or more -% data entries, each separated by a \emph{space}. The valid forms are thus -% \begin{itemize} -% \item \texttt{gray \meta{gray}} Grayscale color with the \meta{gray} -% value running from $0$ (fully black) to $1$ (fully white) -% \item \texttt{cmyk \meta{cyan} \meta{magenta} \meta{yellow} \meta{black}}, -% each of which falls in the range $[0,1]$ -% \item \texttt{rgb \meta{red} \meta{green} \meta{blue}}, -% each of which falls in the range $[0,1]$ -% \item \texttt{spot \meta{name} \meta{tint}} A pre-defined spot color, -% where the \meta{name} should be a pre-defined string color name and the -% \meta{tint} should be in the range $[0,1]$. -% \end{itemize} +% representation of color, comprising two \meta{balanced text} entries, the first +% the \meta{model} and the second the \meta{values} given +% \emph{separated by spaces}. % % This core representation is produced when parsing color expressions. % @@ -286,7 +275,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3color}{2020-06-03}{} +\ProvidesExplPackage{l3color}{2020-06-18}{} {L3 Experimental color support} %</package> % \end{macrocode} @@ -342,7 +331,7 @@ % \end{macro} % % \begin{macro}{\@@_extract:nNN, \@@_extract:VNN} -% \begin{macro}{\@@_extract:NNw} +% \begin{macro}{\@@_extract:NNnn} % Split the model and color from a named color, and store the two. No test % for the existence of the color: that is assumed to be the case (this % is internal only). Somewhat \enquote{old-fashioned} but should be quite @@ -351,13 +340,13 @@ \cs_new_protected:Npn \@@_extract:nNN #1#2#3 { \exp_after:wN \exp_after:wN \exp_after:wN - \@@_extract:NNw + \@@_extract:NNnn \exp_after:wN \exp_after:wN \exp_after:wN #2 \exp_after:wN \exp_after:wN \exp_after:wN #3 - \cs:w l_@@_named_ #1 _tl \cs_end: \s_@@_stop + \cs:w l_@@_named_ #1 _tl \cs_end: } \cs_generate_variant:Nn \@@_extract:nNN { V } -\cs_new_protected:Npn \@@_extract:NNw #1#2 #3 ~ #4 \s_@@_stop +\cs_new_protected:Npn \@@_extract:NNnn #1#2#3#4 { \tl_set:Nn #1 {#3} \tl_set:Nn #2 {#4} @@ -517,7 +506,7 @@ \@@_extract:nNN {#2} \l_@@_model_tl \l_@@_value_tl \@@_parse_loop:w #3 ! ! ! ! \s_@@_stop \tl_set:Nx \l_@@_internal_tl - { \l_@@_model_tl \c_space_tl \l_@@_value_tl } + { { \l_@@_model_tl } { \l_@@_value_tl } } \exp_args:NNNV \group_end: \tl_set:Nn #1 \l_@@_internal_tl } @@ -663,26 +652,30 @@ % Turn the input into internal form, also tidying up the number quickly. % \begin{macrocode} \cs_new:Npn \@@_parse_model_gray:w #1 , #2 \s_@@_stop - { gray ~ \@@_parse_number:n {#1} } + { { gray } { \@@_parse_number:n {#1} } } \cs_new:Npn \@@_parse_model_rgb:w #1 , #2 , #3 , #4 \s_@@_stop { - rgb ~ - \@@_parse_number:n {#1} ~ - \@@_parse_number:n {#2} ~ - \@@_parse_number:n {#3} + { rgb } + { + \@@_parse_number:n {#1} ~ + \@@_parse_number:n {#2} ~ + \@@_parse_number:n {#3} + } } \cs_new:Npn \@@_parse_model_cmyk:w #1 , #2 , #3 , #4 , #5 \s_@@_stop { - cmyk ~ - \@@_parse_number:n {#1} ~ - \@@_parse_number:n {#2} ~ - \@@_parse_number:n {#3} ~ - \@@_parse_number:n {#4} + { cmyk } + { + \@@_parse_number:n {#1} ~ + \@@_parse_number:n {#2} ~ + \@@_parse_number:n {#3} ~ + \@@_parse_number:n {#4} + } } \cs_new:Npn \@@_parse_model_spot:w #1 , #2 \s_@@_stop { - spot ~ - \@@_parse_spot_aux:w #1 ! 100 ! \s_@@_stop + { spot } + { \@@_parse_spot_aux:w #1 ! 100 ! \s_@@_stop } } \cs_new:Npn \@@_parse_spot_aux:w #1 ! #2 ! #3 \s_@@_stop { #1 ~ \fp_eval:n { #2 / 100 } } @@ -716,9 +709,11 @@ % \begin{macrocode} \cs_new:Npn \@@_parse_model_hsb:nnn #1#2#3 { - rgb ~ - \exp_args:Ne \@@_parse_model_hsb_aux:nnn - { \fp_eval:n { 6 * #1 } } {#2} {#3} + { rgb } + { + \exp_args:Ne \@@_parse_model_hsb_aux:nnn + { \fp_eval:n { 6 * #1 } } {#2} {#3} + } } \cs_new:Npn \@@_parse_model_hsb_aux:nnn #1#2#3 { @@ -758,17 +753,21 @@ { \@@_parse_model_HTML_aux:w #1 0 0 0 0 0 0 \s_@@_stop } \cs_new:Npn \@@_parse_model_HTML_aux:w #1#2#3#4#5#6#7 \s_@@_stop { - rgb ~ - \fp_eval:n { round(\int_from_hex:n {#1#2} / 255,5) } ~ - \fp_eval:n { round(\int_from_hex:n {#3#4} / 255,5) } ~ - \fp_eval:n { round(\int_from_hex:n {#5#6} / 255,5) } + { rgb } + { + \fp_eval:n { round(\int_from_hex:n {#1#2} / 255,5) } ~ + \fp_eval:n { round(\int_from_hex:n {#3#4} / 255,5) } ~ + \fp_eval:n { round(\int_from_hex:n {#5#6} / 255,5) } + } } \cs_new:Npn \@@_parse_model_RGB:w #1 , #2 , #3 , #4 \s_@@_stop { - rgb ~ - \fp_eval:n { round(#1 / 255,5) } ~ - \fp_eval:n { round(#2 / 255,5) } ~ - \fp_eval:n { round(#3 / 255,5) } + { rgb } + { + \fp_eval:n { round(#1 / 255,5) } ~ + \fp_eval:n { round(#2 / 255,5) } ~ + \fp_eval:n { round(#3 / 255,5) } + } } % \end{macrocode} % \end{macro} @@ -783,24 +782,24 @@ % \end{variable} % % \begin{macro}{\@@_check_model:N} -% \begin{macro}{\@@_check_model:w} +% \begin{macro}{\@@_check_model:nn} % Check that the model in use is the one required. % \begin{macrocode} \cs_new_protected:Npn \@@_check_model:N #1 { \tl_if_empty:NF \l_color_fixed_model_tl { - \exp_after:wN \@@_check_model:w #1 \s_@@_stop + \exp_after:wN \@@_check_model:nn #1 \tl_if_eq:NNF \l_@@_model_tl \l_color_fixed_model_tl { \@@_convert:VVN \l_@@_model_tl \l_color_fixed_model_tl \l_@@_value_tl } \tl_set:Nx #1 - { \l_color_fixed_model_tl \c_space_tl \l_@@_value_tl } + { { \l_color_fixed_model_tl } { \l_@@_value_tl } } } } -\cs_new_protected:Npn \@@_check_model:w #1 ~ #2 \s_@@_stop +\cs_new_protected:Npn \@@_check_model:nn #1#2 { \tl_set:Nn \l_@@_model_tl {#1} \tl_set:Nn \l_@@_value_tl {#2} @@ -818,7 +817,7 @@ \cs_new_protected:Npn \@@_select: { \tl_set_eq:cN { l_@@_named_ . _tl } \l_@@_current_tl - \@@_select:V \l_@@_current_tl + \@@_select:N \l_@@_current_tl } % \end{macrocode} % \end{macro} @@ -852,7 +851,7 @@ \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 } + { \use:c { @@_parse_model_ #1 :w } #2 , 0 , 0 , 0 , 0 \s_@@_stop } \@@_check_model:N #3 } { @@ -946,8 +945,7 @@ % \subsection{Diagnostics} % % \begin{macro}{\color_show:n} -% \begin{macro}{\@@_show:w} -% \begin{macro}{\@@_show_gray:w, \@@_show_rgb:w, \@@_show_cmyk:w} +% \begin{macro}{\@@_show:nn} % Extract the information about a color and format for the user: the approach % is similar to the keys module here. % \begin{macrocode} @@ -957,25 +955,20 @@ {#1} { \@@_if_defined:nTF {#1} - { \exp_last_unbraced:Nv \@@_show:w { l_@@_named_ #1 _tl } \s_@@_stop } + { \exp_last_unbraced:Nv \@@_show:nn { l_@@_named_ #1 _tl } } { } } { } { } } -\cs_new:Npn \@@_show:w #1 ~ #2 \s_@@_stop +\cs_new:Npn \@@_show:nn #1#2 { \msg_show_item_unbraced:nn { model } {#1} - \exp_args:Nnf \msg_show_item_unbraced:nn { value } - { \use:c { @@_show_ #1 :w } #2 \s_@@_stop } + \msg_show_item_unbraced:nn { value } {#2} } -\cs_new:Npn \@@_show_gray:w #1 \s_@@_stop { #1 } -\cs_new:Npn \@@_show_rgb:w #1 ~ #2 ~ #3 \s_@@_stop { #1 ,~ #2 ,~ #3 } -\cs_new:Npn \@@_show_cmyk:w #1 ~ #2 ~ #3 ~ #4 \s_@@_stop { #1 ,~ #2 ,~ #3 ,~ #4 } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % % \subsection{Messages} % |