ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: color expansion at runtime
Date: Fri, 14 Dec 2007 19:59:00 +0100	[thread overview]
Message-ID: <4762D274.1060803@gmx.net> (raw)
In-Reply-To: <5762F430-5AD2-4E91-B6D3-8E14D46F615F@uni-bonn.de>

Thomas A. Schmitz schrieb:
> 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
>
Thanks Thomas for your help.

I can do this without low-level trickery, but this would mean one or two
(fore|backgroundcolor) additional macro(s) per building block (>20) for
every graphic style (currently 2; more to come). This makes about 60
stupid little macros..... nope.
I think that in some special cases I must do this anyway (where the
color is choosen from a combination of states), but most times a general
macro will do.

I will try to get it run this weekend (have to learn TeX debugging
first). But I wouldn't be surprised if this is the easier part of the
problem. We will see :)


Greetings, Peter

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

___________________________________________________________________________________
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	other threads:[~2007-12-14 18:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-14 16:57 Peter Rolf
2007-12-14 17:12 ` Thomas A. Schmitz
2007-12-14 18:59   ` Peter Rolf [this message]
2007-12-15 10:17 ` Wolfgang Schuster
2007-12-15 14:07   ` Peter Rolf
2007-12-15 16:16     ` Wolfgang Schuster
2007-12-17  8:49 ` Hans Hagen
2007-12-17 10:33 ` Taco Hoekwater
2007-12-17 15:01   ` Peter Rolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4762D274.1060803@gmx.net \
    --to=indiego@gmx.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).