From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/103394 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mohammad Hossein Bateni Newsgroups: gmane.comp.tex.context Subject: Re: Define color with calculations Date: Mon, 18 Feb 2019 11:44:31 -0500 Message-ID: References: <45db3223-6cdf-bb4e-e844-034f1f45f6a1@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8729994183125548045==" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="186140"; mail-complaints-to="usenet@blaine.gmane.org" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Feb 18 17:45:21 2019 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gvm2j-000mBs-6C for gctc-ntg-context-518@m.gmane.org; Mon, 18 Feb 2019 17:45:21 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id BCBE7EF16C; Mon, 18 Feb 2019 17:44:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gjcGD2J13URH; Mon, 18 Feb 2019 17:44:47 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 18F0FEF169; Mon, 18 Feb 2019 17:44:47 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 553B4EF169 for ; Mon, 18 Feb 2019 17:44:45 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hr8nJ5lsFk9v for ; Mon, 18 Feb 2019 17:44:44 +0100 (CET) Original-Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 5FBB8EF15E for ; Mon, 18 Feb 2019 17:44:44 +0100 (CET) Original-Received: by mail-ot1-f53.google.com with SMTP id t7so12916142otk.8 for ; Mon, 18 Feb 2019 08:44:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=6W+zzBIa8QcfAGppnR/59jd98uy4bmt9pRXLi4n8b+4=; b=Y1RComPrJ3OD4iezmX3eKjLhm79XTji7S6uAgG+HE71sL4yABA6TylcFXEEUBDYWfh hkNKPJ710NrXlj9hbVpZcgFtLQxCJUyj+/2vvOhIeb3CYj4SUAvyzYrVSaZtm7aRQD3i cIc1qrMe+vftWSBul2161Z/qg4pbzi/AeuPYZA/ROGcpsz7gE/QfaIVuaxfhJOy45551 BYMRVXqj/vtvHVE10V1zildBGjsIFjY/z874A4bff0i7UDbRn2Mn/4/AQSwCM+o/EXbr o1Og0FaLowJ9MBiuZJDPmBYh6Ss6R2oWAMDuSwBX1+WFsDXe9OjcPcwRF2VrjLgC4Djv JveQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=6W+zzBIa8QcfAGppnR/59jd98uy4bmt9pRXLi4n8b+4=; b=pJx6/azAsMYXO/cFJdymyWL8ro65Xpjw0ZvR8Df3PZgdV0n2ehS/spAFxGO0VaMNwL 8zqvLaM7d/aaa/8Z8UA4SJ7yhwlU8Lma2JdoaNgG6KuF5TO5E0qfkQxE+bglSgBEHMXg tSv9p44aDwkmxpy+wc3n0qJdQJ8Ttho1ZIQKinpRa4QVok6c8wUmwF+D/Z7kSRjR/m3g 1r7dDBP3czn2UiPRPvyPfmjetHex2P7mk44YW51nywE5OloeTvehXCNbeiIgtZLLNY2/ rh1Tk5vr1wHzHMHdTL7LX59rTYcwYg1wwLhtkXUzVzLNnO7r45pus4hCYBS4uFLVEwhr s26Q== X-Gm-Message-State: AHQUAuZLByYF3C4/HdLc1oXyXOIJPquD4WOr/T7N1kxf5Vr1bAQXAiYd KmvGHn6TJiF45Ku5+xFpNhLAwrCC9RQOtxNw6J0yuvD/ X-Google-Smtp-Source: AHgI3IYZ9epY4gkCthsPgbUGv/sz8+fcmf/grF2uybnU75enoEVLrvV3oIEA0f9uQKE6jl6cOEbESLzAGl5jbos+W9Y= X-Received: by 2002:a9d:4c95:: with SMTP id m21mr15944989otf.43.1550508282772; Mon, 18 Feb 2019 08:44:42 -0800 (PST) In-Reply-To: <45db3223-6cdf-bb4e-e844-034f1f45f6a1@gmail.com> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:103394 Archived-At: --===============8729994183125548045== Content-Type: multipart/alternative; boundary="0000000000006a825405822dd779" --0000000000006a825405822dd779 Content-Type: text/plain; charset="UTF-8" Thanks, Henri! Works like a charm. On Sun, Feb 17, 2019 at 11:03 PM Henri Menke 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@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@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 > > ___________________________________________________________________________________ > --0000000000006a825405822dd779 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks, Henri!=C2=A0 Works like a charm.

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


\def\eval#1{\ctxlua{%
=C2=A0 =C2=A0 local context =3D context
=C2=A0 =C2=A0 local _ENV =3D math
=C2=A0 =C2=A0 context(#1)
}}

\definecolor[mycolor][r=3D\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 va= lue
> of a component?=C2=A0 Something like the following...
>
> \definecolor[mycolor][r=3D0.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@ntg.nl / http://www.ntg.nl/mailman/listin= fo/ntg-context
> webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.ne= t
> archive=C2=A0 : https://bitbucket.org/phg/cont= ext-mirror/commits/
> wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
> ______________________________________________________________________= _____________
>

___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/nt= g-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net=
archive=C2=A0 : https://bitbucket.org/phg/context-m= irror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________
--0000000000006a825405822dd779-- --===============8729994183125548045== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============8729994183125548045==--