On 8/21/2013 2:25 AM, Thangalin wrote:
Hi,

What would it take to extend \definecolor so that:

   \definecolor[ColourA][ColourB][t=0.5, a=1]

defines a new colour (ColourB) based on an existing colour (ColourA)?

I know that \definespotcolor[ColourA][ColourB][t=0.5, a=1] works, but
it seems like \definecolor would also be a natural fit.

hm, afaik no one ever needed that (normally one defines colors once on top of the document and there are seldom many of them)

anyhow, as general inheritance is pretty fuzzy i.e. cloning a spot color and changing some rgb component or cloning a cmyk color and setting rgb components it will not be a feature of definecolor

I've added \defineprocesscolor that cna be used as follows:

\starttext

\defineprocesscolor[red][r=.5]

\blackrule[color=red,width=\hsize,height=1cm]

\defineprocesscolor[redish][red][a=1,t=.5]

\blackrule[color=redish,width=\hsize,height=1cm]

\stoptext

But ... as there is some checking of the preferred color space (in context each defined color has a preferred color space and there is also a current colorspace that gets applied) you need to be aware of this:

\starttext

\defineprocesscolor[red][r=.5]

\blackrule[color=red,width=\hsize,height=1cm]

\defineprocesscolor[redish][red][a=1,t=.5]

\blackrule[color=redish,width=\hsize,height=1cm]

\defineprocesscolor[yellowish][red]

\blackrule[color=yellowish,width=\hsize,height=1cm]

\defineprocesscolor[yellowish][red][a=1,t=.5,y=.5]

\blackrule[color=yellowish,width=\hsize,height=1cm]

\defineprocesscolor[cyan][c=.5]

\defineprocesscolor[yellowish][cyan][y=.5]

\blackrule[color=yellowish,width=\hsize,height=1cm]

\stoptext

Now .. as you requested it, you're also the one who's going to wikify it. I'll upload a beta later.

Hans

ps. Transparency operates independently of colors but I never figured out a decent way to let that cooperate with existing colors that have transparency specs without breaking compatibility so it might never happen (in fact we have: current color space, current color, current transparency).

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to