-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access to color by color series name does not work #8
Comments
I'm not sure it is a bug. The code quite explicitly stores the color without backend, and nearly all examples use the But the following should work and set the color with backend:
|
I think the documentation is pretty explicit that just using the color series name should be fine, e.g.
from section 2.3.1 or
from section 2.9.4. (Uwe Kern also seemed to agree: He wrote "das wirkt tatsächlich wie ein Bug" in reply to my email reporting this.) |
Regarding your suggestion: It seems to only work as long as the color series isn't stepped: \documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{xcolor}
\makeatletter
\def\XC@resetcolorseries[#1]#2%
{\begingroup
\@namexdef
{\@backslashchar color@#2}{\noexpand\xcolor@{}{}\@nameuse{\@backslashchar colorB@#2}}%
\xglobal\colorlet{foo}{foo!}% <----
\XC@let@Nc\@@tmp{\@backslashchar colorD@#2}%
\edef\@@met{\expandafter\@firstoftwo\@@tmp}%
\edef\@@tmp{\expandafter\@secondoftwo\@@tmp}%
\ifx\@@met\XC@met@step\else
\edef\@@scl{\@ifxempty{#1}\colorseriescycle{#1}}%
\expandafter\XC@calc@\@@tmp,,,,:D%
\fi
\@namexdef{\@backslashchar colorS@#2}{\@@tmp}%
\endgroup}
\makeatother
\begin{document}
\definecolorseries{foo}{rgb}{last}{blue}{red}
\resetcolorseries{foo}
% works now
\textcolor{foo}{\rule{1ex}{1ex}}
% always worked
\textcolor{foo!!+}{\rule{1ex}{1ex}}
% still doesn't work
\textcolor{foo}{\rule{1ex}{1ex}}
\end{document} |
I didn't find it very explicit. On the whole I had the impression that it doesn't really consider the case of using the color without stepping. In any case: one must set the color also in the step code. Be aware that
|
Hmm, ok. I thought stating that one may use Your last MWE looks good to me. At least I couldn't find any issues playing around with it for a bit. Thank you! |
(I reported this bug via email a couple years ago, but it seems maintenance has changed, so I report it again here.)
The following MWE produces a black square even though it should produce a blue one according to the documentation.
From what I understood, this is due to the fact that the second argument of
\xcolor@
in\\color@foo
is empty.As a workaround, one can use the (undocumented) syntax
\color{foo!!}
, but the documented\color{foo}
would be preferred.The text was updated successfully, but these errors were encountered: