* color expansion (not colo-new related)
@ 2007-08-30 17:30 Peter Rolf
2007-08-30 18:47 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Peter Rolf @ 2007-08-30 17:30 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: text/plain, Size: 367 bytes --]
Hi all,
I tried to seperate some style specific code to external variables. Most
things work so far, but the expansion of color causes me problems. I
must emphasize that this is no colo-new problem, as my code fails with
the old colo-ini too.
I have tried several things, but still no luck. What (expansion) magic
is missing in my code? Any help is welcome.
Peter
[-- Attachment #2: fgcolor.tex --]
[-- Type: text/plain, Size: 772 bytes --]
\setupcolors[state=start]
\newconditional\CondA
\newconditional\CondB
\newconditional\CondC
% state dependend color
\def\GetFGcolor#1#2#3#4#5{%
\ifconditional\CondA
\ifconditional\CondC#4
\else#5\fi
\else
\ifconditional\CondB#1
\else
\ifconditional\CondC#2
\else#3\fi
\fi
\fi}%
\starttext
%\settrue\CondA
%\settrue\CondB
\settrue\CondC
\setvariables[FOO][foregroundcolor=\GetFGcolor{red}{green}{blue}{lightgray}{darkgray}]
\color[red]{color} is working.
\edef\FGcolor{\getvariable{FOO}{foregroundcolor}}
%\edef\FGcolor{\GetFGcolor{red}{green}{blue}{lightgray}{darkgray}}
FGcolor=\FGcolor
foregroundcolor= \color[\FGcolor]{\getvariable{FOO}{foregroundcolor}}% no color here
\stoptext
[-- Attachment #3: Type: text/plain, Size: 487 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: color expansion (not colo-new related)
2007-08-30 17:30 color expansion (not colo-new related) Peter Rolf
@ 2007-08-30 18:47 ` Hans Hagen
2007-08-30 19:37 ` Peter Rolf
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2007-08-30 18:47 UTC (permalink / raw)
To: mailing list for ConTeXt users
Peter Rolf wrote:
> Hi all,
>
> I tried to seperate some style specific code to external variables. Most
> things work so far, but the expansion of color causes me problems. I
> must emphasize that this is no colo-new problem, as my code fails with
> the old colo-ini too.
>
> I have tried several things, but still no luck. What (expansion) magic
> is missing in my code? Any help is welcome.
\def\GetFGcolor#1#2#3#4#5{%
\ifconditional\CondA
\ifconditional\CondC#4%
\else#5\fi
\else
\ifconditional\CondB#1%
\else
\ifconditional\CondC#2%
\else#3\fi
\fi
\fi}
you introduce spaces
btw, often its easier to remap colors
\def\test{\color[whatever]{some color}}
\definecolor[whatever][green] test
\definecolor[whatever][red] test
or to use palets or ...
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: color expansion (not colo-new related)
2007-08-30 18:47 ` Hans Hagen
@ 2007-08-30 19:37 ` Peter Rolf
0 siblings, 0 replies; 3+ messages in thread
From: Peter Rolf @ 2007-08-30 19:37 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hans Hagen schrieb:
> Peter Rolf wrote:
>> Hi all,
>>
>> I tried to seperate some style specific code to external variables. Most
>> things work so far, but the expansion of color causes me problems. I
>> must emphasize that this is no colo-new problem, as my code fails with
>> the old colo-ini too.
>>
>> I have tried several things, but still no luck. What (expansion) magic
>> is missing in my code? Any help is welcome.
>
> \def\GetFGcolor#1#2#3#4#5{%
> \ifconditional\CondA
> \ifconditional\CondC#4%
> \else#5\fi
> \else
> \ifconditional\CondB#1%
> \else
> \ifconditional\CondC#2%
> \else#3\fi
> \fi
> \fi}
>
> you introduce spaces
>
yes, stupid me :)
> btw, often its easier to remap colors
>
>
>
> \def\test{\color[whatever]{some color}}
>
> \definecolor[whatever][green] test
> \definecolor[whatever][red] test
>
> or to use palets or ...
>
I will think about it.
Thanks Hans!
>
> -----------------------------------------------------------------
> Hans Hagen | PRAGMA ADE
> Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
> | www.pragma-pod.nl
> -----------------------------------------------------------------
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive : https://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-30 19:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-30 17:30 color expansion (not colo-new related) Peter Rolf
2007-08-30 18:47 ` Hans Hagen
2007-08-30 19:37 ` Peter Rolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).