2007/12/15, Peter Rolf <[EMAIL PROTECTED]>: > Wolfgang Schuster schrieb: > > 2007/12/14, Peter Rolf <[EMAIL PROTECTED]>: > >> 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. > >> > >> Regards, Peter > > > > Hi Peter, > > > > can you try this (untested), > > Hi Wolfgang, > > your idea works pretty good (I haven't thought about \ifcase 'til now). > Still the problem is, that > > - currentstate must be set somehow > - the colors and the number of used states vary from macro to macro > > So I have to define individual variants of \statecolor (with non fixed > state=number pairs), or add an entry for every single state (currently > 9). The later method is too ugly (imagine the case that you only need > states 0 and 8) and will be hard to maintain if new states arise.
It is hard to give a better solution because I don't what do you want to achive and how your interface should look to change the states and colors ... > I end up with 60 macros and that is what I want to avoid. Anyhow thanks > for your help. > I will try to trace my color macro while listening the right music for > such problems (Yo La Tengo - I am not afraid of you and will beat your > ass). Hopefully it works. ;) > > Greetings, Peter I wish you good luck to find a better solution, I'm myself a little busy till monday and can't help you for the moment and I run into a few other ConTeXt problems (and bugs, mkii and mkiv) the last two days and wasted to many time with them. Wolfgang ___________________________________________________________________________________ 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 ___________________________________________________________________________________