Peter Rolf wrote:
                                
> Hans Hagen schrieb:

>> so, what exactly do you need the number for
> 
> for overprinting (text only) i have to test if the current color is
> black. overprinting should be activated for all text elements, but if
> the print color is non black, overprinting should be disabled.

so, how about something that just works -)

\setupcolors[state=start]

\startluacode
function ctx.isblack(ca) -- name might change
     local cv = ca > 0 and colors.value(ca)
     return (cv and cv[2] == 0) or false
end
\stopluacode

\def\doifblackelse#1%
   {\ctxlua{commands.doifelse(ctx.isblack(\thecolorattribute{#1}))}}

\def\doifdrawingblackelse 
{\ctxlua{commands.doifelse(ctx.isblack(tex.attribute[attributes.numbers['color']]))}}

\starttext

     \definecolor[foo][black]
     {\red red {\foo (\doifblackelse{foo}{YES}{NO}
        \doifdrawingblackelse{YES}{NO}) black} red}

     \definecolor[foo][green]
     {\red red {\foo (\doifblackelse{foo}{YES}{NO}
        \doifdrawingblackelse{YES}{NO}) green} red}

\stoptext

less code and more abstract

-----------------------------------------------------------------
                                           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
-----------------------------------------------------------------
_______________________________________________
dev-context mailing list
[email protected]
http://www.ntg.nl/mailman/listinfo/dev-context

Reply via email to