On Dec 14, 2007, at 5:57 PM, Peter Rolf wrote:

> Hi,
>
> I desperately need runtime defined colors (state dependent) for my
> macros. The macros are used with different graphic styles, which is  
> the
> reason why I want to avoid any style dependent part inside them.
>
> To give you an example. I need something like this
>
> \color 
> [{\StateDependentColor[stateA=green,stateC=blue,whatever=yellow,...]}]
>
> If flag 'stateA' is true at runtime, then color 'green' is used (and  
> so
> on; order is significant).
>
> I have written such a macro, but sadly it crashes when used inside
> \color or \definecolor. Tried to debug it, but this is my first
> experience with the trace commands (probably not the best example to
> start with). Sigh, still so much to learn.. :)
>
> Any hints are welcome.

I'm not quite sure I understand what you're trying to do, so this is a  
shot in the dark: instead of low-level trickery, you could use ConTeXt  
modes:

\startmode[A]
\definecolor [mycolor] [g=1]
\stopmode

\startmode[B]
\definecolor [mycolor] [r=1]
\stopmode

You can then set \enablemode[A] in your file or pass the mode on the  
commandline: texexec --mode=A

HTH

Thomas
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to