[NTG-context] Define color with calculations

Mohammad Hossein Bateni bateni at gmail.com
Mon Feb 18 17:44:31 CET 2019


Thanks, Henri!  Works like a charm.

On Sun, Feb 17, 2019 at 11:03 PM Henri Menke <henrimenke at gmail.com> wrote:

> Use Lua.
>
>
> \def\eval#1{\ctxlua{%
>     local context = context
>     local _ENV = math
>     context(#1)
> }}
>
> \definecolor[mycolor][r=\eval{0.5*0.7}]
>
> \starttext
>
> \color[mycolor]{Hello!}
>
> \stoptext
>
>
>
> On 18/02/19 4:37 PM, Mohammad Hossein Bateni wrote:
> > Hi,
> >
> > When I use definecolor, (how) can I use computations in setting the value
> > of a component?  Something like the following...
> >
> > \definecolor[mycolor][r=0.5*0.7]
> >
> > Thanks,
> > ~MHB
> >
> >
> >
> ___________________________________________________________________________________
> > If your question is of interest to others as well, please add an entry
> to the Wiki!
> >
> > maillist : ntg-context at ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> > webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> > archive  : https://bitbucket.org/phg/context-mirror/commits/
> > wiki     : http://contextgarden.net
> >
> ___________________________________________________________________________________
> >
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context at ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20190218/62334b28/attachment.html>


More information about the ntg-context mailing list