From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/114803 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Fabrice L via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Problem with a defined colour in MetaFun Date: Thu, 28 Apr 2022 08:45:55 -0400 Message-ID: <30FAD77B-AB42-44C1-930F-9D2FE9D9D2CB@gmail.com> References: <3fc7c602-d9de-6b68-e771-240eebee4cb8@gmail.com> <01C4152B-29B6-4CCE-BA43-57D2BCA19868@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Content-Type: multipart/mixed; boundary="===============3548318099931048101==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37855"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Fabrice L , Keith McKay To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Apr 28 14:47:34 2022 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nk3YT-0009TC-8W for gctc-ntg-context-518@m.gmane-mx.org; Thu, 28 Apr 2022 14:47:33 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D07832A37B4; Thu, 28 Apr 2022 14:46:03 +0200 (CEST) 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 h3blP0d1Z2WB; Thu, 28 Apr 2022 14:46:01 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 7FEEB2A3854; Thu, 28 Apr 2022 14:46:01 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id AA4132A3852 for ; Thu, 28 Apr 2022 14:46:00 +0200 (CEST) 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 CMqPVUb7Axna for ; Thu, 28 Apr 2022 14:45:59 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.219.41; helo=mail-qv1-f41.google.com; envelope-from=fabrice.alpha@gmail.com; receiver= Original-Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 247122A37B4 for ; Thu, 28 Apr 2022 14:45:59 +0200 (CEST) Original-Received: by mail-qv1-f41.google.com with SMTP id ke5so3103834qvb.5 for ; Thu, 28 Apr 2022 05:45:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=+lNvKrBtACYcS9+0jw14SOXbEDcEN5WOwMmbzH/Q9Nk=; b=NF/vhkBXJQ98pDookSDlU1fK1E4gl5hAn3KYlbEOlGTWBom6glmZaBFZgMdtTue+62 wzEs06wmLlX0q3P4CS0h6cVGWxysHVMNws54UiuyFRq4UjmdtFM9aoqH51ohy7Ia0tFq mV5Y5A8B1CtMi8hNNoHBeZfFLfx0U3n6BrwhJX6KEJSmeRdRGFXj931nxv63tKyw+Wb8 1Ve4td1BLTyo5neO7z9cHNklDsW15htqqkkDeythTnsXeqcMG/J36kzPodZ5W419WsE4 3RkDM10FKLkKAmmiuKhGnd1uKPHB/VhNHsvvnRF/9jq+okTBgMfyhh1b6SzQhdGqrW8T 4x+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=+lNvKrBtACYcS9+0jw14SOXbEDcEN5WOwMmbzH/Q9Nk=; b=7GlanF69OJ4T6Rp0UBHrtN5bWZe3/zB0zPzyeIiUQbgI829P4MuqqPPeTfQsEOjs4w Eddm2IXf2mqgIqjJ6ez4Zj5fgpHs+QDYcycZY/yLxmLTWQYn+qyUiyXfcsCh793o//P3 eCRgqCa0x41Xk9VK2lxzFg9difMlYi8/2TU+2cXYEsny+oz+ZYFKXx/ZkrUrDEaLVSmR 1lct9ppdTfl+QcriTYlo8Bcwpu4wmPo7Pj4nYUp4uThWpIFt3DWyac8XVsvQ/80H6mb1 fLAwY2aVrQfnDKK2o/WV4+sjptsXnKHmaRzN6tC99YHJ4JVD+E0GcvQ1KcymrB4WAE69 VQqg== X-Gm-Message-State: AOAM533VrJuylon1wbWpU9zWjSIgIRvgWQy6Fw3TP2lJxeuUH6DWW9QW R1NHc48Yy0L1Gdb2oaLD7olLGp1redY= X-Google-Smtp-Source: ABdhPJynaD4L71n58bmYruX6tIWbTp6CfKRzojUOtig/4plqBnM5BigRH1o9z8lucuTkVqCRbbnpcg== X-Received: by 2002:a05:6214:e4a:b0:449:99fd:bff7 with SMTP id o10-20020a0562140e4a00b0044999fdbff7mr23797265qvc.46.1651149956177; Thu, 28 Apr 2022 05:45:56 -0700 (PDT) Original-Received: from smtpclient.apple ([132.208.146.109]) by smtp.gmail.com with ESMTPSA id j1-20020a37a001000000b0069f9e4bd8b9sm1178667qke.17.2022.04.28.05.45.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2022 05:45:55 -0700 (PDT) In-Reply-To: <01C4152B-29B6-4CCE-BA43-57D2BCA19868@gmail.com> X-Mailer: Apple Mail (2.3696.80.82.1.1) 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.io gmane.comp.tex.context:114803 Archived-At: --===============3548318099931048101== Content-Type: multipart/alternative; boundary="Apple-Mail=_E7085CE3-A287-41F2-9C76-EB6F5E539B82" --Apple-Mail=_E7085CE3-A287-41F2-9C76-EB6F5E539B82 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Sorry, I was a little too enthusiastic, here here is the code : > Le 28 avr. 2022 =C3=A0 08:41, Fabrice L a = =C3=A9crit : >=20 > Hi Keith, >=20 >> Le 28 avr. 2022 =C3=A0 06:05, Keith McKay via ntg-context = > a =C3=A9crit : >>=20 >> Hi, >>=20 >> In the MWE below I define an rgb colour, myColor1, using random = numbers for the r, g and b components. I then use it to fill a = unitsquare the size of the page, which works as expected. In the loop = that follows I then use the defined colour, myColor1, along with white = and the variable r to create shades of myColor1 as in the MWE below. = However, myColor1 is not recognised in the loop and seems to be replaced = by black, although if I use a predefined colour, in this case = BurntSienna from the crayola collection, it works as expected. I have = tried a number of ways to get this to work as shown in the code but = without success. I would be grateful for any suggestions. >>=20 >> Best Wishes >>=20 >> Keith McKay >>=20 >> %%%%%%%%%%%%%%%%%%%%MWE%%%%%%%%%%%%% >> \setuppapersize[A4,portrait] >> \usecolors[crayola] >> \starttext >> \dorecurse{10}{ >> \startMPpage >> StartPage; >> \definecolor[name=3D"myColor1", r =3D uniformdeviate(1), g =3D = uniformdeviate(1), b =3D uniformdeviate(1) ] ; >> fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor = "myColor1"; >> for i =3D2 step 2 until 10: >> r :=3D i/10; >> fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) = withcolor(r[\MPcolor{BurntSienna},white]); >> fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) = withcolor(r[\MPcolor{myColor1}, white]); >> fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) = withcolor(r[\MPcolor{"myColor1"}, white]); >> %fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) = withcolor(r[myColor1 , white]); This line causes an error. >> endfor; >> StopPage; >> \stopMPpage >> } >>=20 >> \stoptext >> %%%%%%%%%%%%%%%%%%%%%%%%%%%end MWE%%%%%%%%%%% >>=20 >=20 > Here is a solution, with works here, defining in another way the color = =C2=AB myColor =C2=BB: >=20 > \setuppapersize[A4,portrait] > \usecolors[crayola] > \starttext > \dorecurse{2}{ > \startMPpage > StartPage; > color myColor ; > myColor :=3D (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1)); > fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor = myColor; > for i =3D2 step 2 until 10: > r :=3D i/10; > fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) = withcolor(r[\MPcolor{BurntSienna},white]); > fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) = withcolor(r[\MPcolor{myColor1}, white]); > fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) = withcolor(r[\MPcolor{"myColor1"}, white]); > %fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) = withcolor(r[myColor1 , white]); This line causes an error. > endfor; > StopPage; > \stopMPpage > } >=20 > \stoptext I forgot to remove =C2=AB myColor1 =C2=BB from the others parts of the = code.=20 \setuppapersize[A4,portrait] \usecolors[crayola] \starttext \dorecurse{10}{ \startMPpage StartPage; color myColor ; myColor :=3D (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1)); fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor = myColor; for i =3D2 step 2 until 10: r :=3D i/10; fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) = withcolor(r[\MPcolor{BurntSienna},white]); fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) = withcolor(r[myColor, white]); fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) = withcolor(r[myColor, white]); %fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) = withcolor(r[myColor1 , white]); This line causes an error. endfor; StopPage; \stopMPpage } \stoptext >=20 > Fabrice. >>=20 >> =20 >> = __________________________________________________________________________= _________ >> If your question is of interest to others as well, please add an = entry to the Wiki! >>=20 >> 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 >> = __________________________________________________________________________= _________ --Apple-Mail=_E7085CE3-A287-41F2-9C76-EB6F5E539B82 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Sorry, I was a little too enthusiastic, here here is the code = :

Le 28 avr. 2022 =C3=A0 08:41, Fabrice L = <fabrice.alpha@gmail.com> a =C3=A9crit :

Hi Keith,

Le 28 avr. 2022 =C3=A0 06:05, = Keith McKay via ntg-context <ntg-context@ntg.nl> a =C3=A9crit :

Hi,

In the MWE below I define an rgb = colour, myColor1, using random numbers for the r, g and b components. I = then use it to fill a unitsquare the size of the page, which works as = expected. In the loop that follows I then use the defined colour, = myColor1, along with white and the variable r to create shades of = myColor1 as in the MWE below. However, myColor1 is not recognised in the = loop and seems to be replaced by black, although if I use a predefined = colour, in this case BurntSienna from the crayola collection, it works = as expected.  I have tried a number of ways to get this to work as = shown in the code but without success. I would be grateful for any = suggestions.

Best = Wishes

Keith = McKay

%%%%%%%%%%%%%%%%%%%%MWE%%%%%%%%%%%%%
\setuppapersize[A4,portrait]
\usecolors[crayola]
\starttext
\dorecurse{10}{
\startMPpage
StartPage;
\definecolor[name=3D"myColor1", r =3D = uniformdeviate(1), g =3D uniformdeviate(1), b =3D uniformdeviate(1) ] = ;
fill unitsquare xscaled PaperWidth yscaled = PaperHeight withcolor "myColor1";
for i =3D2= step 2 until 10:
r :=3D i/10;
fill = unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) = withcolor(r[\MPcolor{BurntSienna},white]);
fill = unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) = withcolor(r[\MPcolor{myColor1}, white]);
fill = unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) = withcolor(r[\MPcolor{"myColor1"}, white]);
%fill = unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) = withcolor(r[myColor1 , white]); This line causes an error.
endfor;
StopPage;
\stopMPpage
}

\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%end = MWE%%%%%%%%%%%

Here is a = solution, with works here, defining in another way the color =C2=AB =  myColor =C2=BB:

\setuppapersize[A4,portrait]
\usecolors[crayola]
\starttext
\dorecurse{2}{
\startMPpage
StartPage;
color myColor ;
myColor :=3D = (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));
fill unitsquare xscaled PaperWidth yscaled PaperHeight = withcolor myColor;
for i =3D2 step 2 until = 10:
r :=3D i/10;
fill = unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) = withcolor(r[\MPcolor{BurntSienna},white]);
fill = unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) = withcolor(r[\MPcolor{myColor1}, white]);
fill = unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) = withcolor(r[\MPcolor{"myColor1"}, white]);
%fill = unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) = withcolor(r[myColor1 ,  white]); This line causes an = error.
endfor;
StopPage;
\stopMPpage
}

\stoptext

I forgot to remove =C2=AB myColor1 =C2=BB = from the others parts of the = code. 
\setuppapersize[A4,portrait]
\usecolors[cr= ayola]
\starttext
\dorecurse{10}{
\startMPpa= ge
StartPage;
color myColor ;
myColor :=3D = (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));
fill = unitsquare xscaled PaperWidth yscaled PaperHeight withcolor = myColor;
for i =3D2 step 2 until 10:
r :=3D = i/10;
fill unitsquare xscaled 5cm yscaled .5cm shifted = (1cm,i*cm) withcolor(r[\MPcolor{BurntSienna},white]);
fill = unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) = withcolor(r[myColor, white]);
fill unitsquare xscaled 5cm = yscaled .5cm shifted (13cm,i*cm) withcolor(r[myColor, = white]);
%fill unitsquare xscaled 5cm yscaled .5cm shifted = (13cm,i*cm) withcolor(r[myColor1 ,  white]); This line causes an = error.
endfor;
StopPage;
\stopMPpage
}

\stoptext



Fabrice.

_________________________________= __________________________________________________
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
_______________________________________________________________= ____________________

= --Apple-Mail=_E7085CE3-A287-41F2-9C76-EB6F5E539B82-- --===============3548318099931048101== 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== --===============3548318099931048101==--