summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-01-17 21:03:39 +0000
committerKarl Berry <karl@freefriends.org>2023-01-17 21:03:39 +0000
commitcdd6583187a0b89e61452f9d73b84dd85efd1d2e (patch)
tree9c6f60f06a3f7374242e90acb1825f7cb3b463c2 /Master/texmf-dist/tex/latex
parent067d9db9be935a1c03bace2969f3e3ac80c4d691 (diff)
gradient-text (17jan23)
git-svn-id: svn://tug.org/texlive/trunk@65567 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/gradient-text/gradient-text.sty47
1 files changed, 26 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/latex/gradient-text/gradient-text.sty b/Master/texmf-dist/tex/latex/gradient-text/gradient-text.sty
index 62494481f4b..56010b4c9bf 100644
--- a/Master/texmf-dist/tex/latex/gradient-text/gradient-text.sty
+++ b/Master/texmf-dist/tex/latex/gradient-text/gradient-text.sty
@@ -1,31 +1,36 @@
+% Copyright (C) 2022-2023 by Sicheng Du <siddsc@foxmail.com>
+% This project is distributed under the LaTeX Project Public License, version 1.3c.
+%-------------------------%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{gradient-text}[2022/12/24]
+\ProvidesPackage{gradient-text}[2023/1/17]
\ExplSyntaxOn
-\clist_new:N\l_FirstRGB_int \clist_new:N\l_LastRGB_int
-\int_new:N\l_MaxIndex\int_new:N\l_Ratio
-\newcommand{\@radientR@B}[7]{
- \int_set:Nn\l_MaxIndex{\int_eval:n{\str_count:n{#1}}}
- \int_step_inline:nnn{1}{\l_MaxIndex}{
+\clist_new:N\l_gtext_FirstRGB_clist
+\clist_new:N\l_gtext_LastRGB_clist
+\int_new:N\l_gtext_MaxIndex_int
+\int_new:N\l_gtext_Ratio_int
+\newcommand{\gr@dientRGB}[7]{
+ \int_set:Nn\l_gtext_MaxIndex_int{\int_eval:n{\str_count:n{#1}}}
+ \int_step_inline:nnn{1}{\l_gtext_MaxIndex_int}{
\exp_args:Ne\str_if_eq:nnTF{\str_item:Nn{#1}{##1}}{~}{}{
- \int_set:Nn\l_Ratio{\int_eval:n{\l_Ratio+1}}
+ \int_set:Nn\l_gtext_Ratio_int{\int_eval:n{\l_gtext_Ratio_int+1}}
}
\color_select:nn{RGB}{
- \int_eval:n{(\int_use:N\l_Ratio*#5+(\l_MaxIndex-##1)*#2)/\l_MaxIndex},
- \int_eval:n{(\int_use:N\l_Ratio*#6+(\l_MaxIndex-##1)*#3)/\l_MaxIndex},
- \int_eval:n{(\int_use:N\l_Ratio*#7+(\l_MaxIndex-##1)*#4)/\l_MaxIndex}
+ \int_eval:n{(\int_use:N\l_gtext_Ratio_int*#5+(\l_gtext_MaxIndex_int-##1)*#2)/\l_gtext_MaxIndex_int},
+ \int_eval:n{(\int_use:N\l_gtext_Ratio_int*#6+(\l_gtext_MaxIndex_int-##1)*#3)/\l_gtext_MaxIndex_int},
+ \int_eval:n{(\int_use:N\l_gtext_Ratio_int*#7+(\l_gtext_MaxIndex_int-##1)*#4)/\l_gtext_MaxIndex_int}
}\str_item:Nn{#1}{##1}
}
}
-
\NewDocumentCommand\gradientRGB{mmm}{{
- \clist_set:Nn\l_FirstRGB_int #2
- \clist_set:Nn\l_LastRGB_int #3
- \@radientR@B{#1}
- {\clist_item:Nn\l_FirstRGB_int{1}}
- {\clist_item:Nn\l_FirstRGB_int{2}}
- {\clist_item:Nn\l_FirstRGB_int{3}}
- {\clist_item:Nn\l_LastRGB_int{1}}
- {\clist_item:Nn\l_LastRGB_int{2}}
- {\clist_item:Nn\l_LastRGB_int{3}}
+ \clist_set:Nn\l_gtext_FirstRGB_clist {#2}
+ \clist_set:Nn\l_gtext_LastRGB_clist {#3}
+ \gr@dientRGB{#1}
+ {\clist_item:Nn\l_gtext_FirstRGB_clist{1}}
+ {\clist_item:Nn\l_gtext_FirstRGB_clist{2}}
+ {\clist_item:Nn\l_gtext_FirstRGB_clist{3}}
+ {\clist_item:Nn\l_gtext_LastRGB_clist{1}}
+ {\clist_item:Nn\l_gtext_LastRGB_clist{2}}
+ {\clist_item:Nn\l_gtext_LastRGB_clist{3}}
}}
-\ExplSyntaxOff \ No newline at end of file
+\ExplSyntaxOff
+%---End of package code---% \ No newline at end of file