From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/114812 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Keith McKay via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Problem with a defined colour in MetaFun Date: Fri, 29 Apr 2022 14:19:28 +0100 Message-ID: <95b5aaa8-298b-e52b-d2c9-d2a12d446ee9@gmail.com> References: <3fc7c602-d9de-6b68-e771-240eebee4cb8@gmail.com> <53af5dbe-fabd-6dc8-8dc7-8b86e44d8ba5@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7534510876879992785==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10228"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Cc: Keith McKay To: Wolfgang Schuster , mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Apr 29 15:26:06 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 1nkQdK-0002La-40 for gctc-ntg-context-518@m.gmane-mx.org; Fri, 29 Apr 2022 15:26:06 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 833822A38A3; Fri, 29 Apr 2022 15:19:45 +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 dyVOhH4oU6vA; Fri, 29 Apr 2022 15:19:43 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2E4E12A38A4; Fri, 29 Apr 2022 15:19:43 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4F4692A3883 for ; Fri, 29 Apr 2022 15:19:40 +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 nFDOfXNo0ocs for ; Fri, 29 Apr 2022 15:19:38 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.221.42; helo=mail-wr1-f42.google.com; envelope-from=mckaymeister@gmail.com; receiver= Original-Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 5627A2A3895 for ; Fri, 29 Apr 2022 15:19:38 +0200 (CEST) Original-Received: by mail-wr1-f42.google.com with SMTP id e2so10773055wrh.7 for ; Fri, 29 Apr 2022 06:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to; bh=d0rWaQaFFJMawQRLcd3tIbN2DolDB7N16CDN3j6M7Ls=; b=Nl3dt8HXvMx+jdE0lkGwAOJhj6BuKSZvgXWGnpVVCVo3J8PqpjOq6dKteDVS4pG77I W8GOXvAPXj76GnN5ezWilDmwS3mcdK+K9VHURhHFsCJnsLDd1q0RNObPRApthZxzpbKP iQXwf3VHDIzT+xtNMzgaCH4EqM5G7Hs4muo+YgRbokDANvHt5Qfwd1kddTg4ibrAH93x IlTlIDoKkN6NCyYJw5n/45suRsTgYFWD/0hwyC0YkUs1BNp1X8XvX+qLreucVMtb7Jkh Hrw4RCe3GB5ZMDDt0EXcOc+DTfDCdCEWnODIxJ3NflhH5AMADJKLqAwaC7PjZpaR2ooE WMBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to; bh=d0rWaQaFFJMawQRLcd3tIbN2DolDB7N16CDN3j6M7Ls=; b=Mm+YTtfZMY/MeuOjDYLoCAGLB3bj1ThpSF0pXNCgEjwNyp7uxsuhKIDDQg6L3ja3r+ Ms1HMJLDufGALsfcTpzgCm1i1nc8gox+09e4R8gzpLGKvOY5WQXjBYS9xLM6WaOmZXn0 Y3bGfMGPL7+e8k4P2WNpk104nPSp2WjEuQT9l4CE201eH1KZejd1eO64U3IrwZG4TJmy Y1LDcAFPbQUBTwVm+/9c8Ft1IQv89/wQ4tXnuKEPFF+Deuk4GkVZzRtQDmCwbYwzZW3/ OkIpR51d7CaGSLQqbbsDfh3y1r00i6YHinpBuhRBDbqANIB9bwxJL8Omfbl6dK/iDjbN kW4Q== X-Gm-Message-State: AOAM5324svjvdXO8WEHk4dVbuNF4MeJ0OiWOIdlB1LXvM0pg7UyLyEDl 9oNJ6VT1cT7vU70Iw8355+Qf70bbMicMWA== X-Google-Smtp-Source: ABdhPJwlY5zgv0Jd2Mvj4kaaElYBtF42s+lPIAjhF3RgN7+AIb8AGnvotYQ3zIFQCTNqd82YBLKktg== X-Received: by 2002:a5d:4311:0:b0:205:f439:cbf0 with SMTP id h17-20020a5d4311000000b00205f439cbf0mr31229198wrq.164.1651238376993; Fri, 29 Apr 2022 06:19:36 -0700 (PDT) Original-Received: from [192.168.0.33] (cpc100594-uddi29-2-0-cust51.20-3.cable.virginm.net. [82.42.107.52]) by smtp.gmail.com with ESMTPSA id d30-20020adfa41e000000b0020aea37380fsm2321199wra.105.2022.04.29.06.19.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Apr 2022 06:19:36 -0700 (PDT) Content-Language: en-GB In-Reply-To: <53af5dbe-fabd-6dc8-8dc7-8b86e44d8ba5@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.io gmane.comp.tex.context:114812 Archived-At: This is a multi-part message in MIME format. --===============7534510876879992785== Content-Type: multipart/alternative; boundary="------------gDdolt8WPK6Gu6N01iCd8iTh" Content-Language: en-GB This is a multi-part message in MIME format. --------------gDdolt8WPK6Gu6N01iCd8iTh Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Wolfgang, Thank you for your reply. I did as you suggested but it still never worked. However it did make me delve further into the Metafun, LuaMetaFun and the Colouring ConTeXt manuals where I found examples of the *resolvedcolor* helper which I used as follows: definecolor [name = "myColor", r = uniformdeviate(1), g = uniformdeviate(1), b = uniformdeviate(1)]; for loop.. fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) withcolor(r[resolvedcolor("myColor"), white]); endfor; I also found the *namedcolor* helper and I could use it as follows: fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,(2*i)*cm) withcolor namedcolor("myColor2") ; However, for some reason it did not work in: fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) withcolor(r[namedcolor("myColor"), white]); // Thanks again for your suggestion// Best Wishes Keith// On 28/04/2022 16:04, Wolfgang Schuster wrote: > Keith McKay via ntg-context schrieb am 28.04.2022 um 12:05: >> >> 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="myColor1", r = uniformdeviate(1), g = >> uniformdeviate(1), b = uniformdeviate(1) ] ; >> > > Remove the backslash in front of the definecolor command. > > Wolfgang > --------------gDdolt8WPK6Gu6N01iCd8iTh Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi Wolfgang,

Thank you for your reply. I did as you suggested but it still never worked. However it did make me delve further into the Metafun, LuaMetaFun and the Colouring ConTeXt manuals where I found examples of the resolvedcolor helper which I used as follows:

definecolor [name = "myColor", r = uniformdeviate(1), g = uniformdeviate(1), b = uniformdeviate(1)];

for loop..

fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) withcolor(r[resolvedcolor("myColor"), white]);

endfor;

I also found the namedcolor helper and I could use it as follows:

fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,(2*i)*cm) withcolor namedcolor("myColor2") ;

However, for some reason it did not work in:

fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) withcolor(r[namedcolor("myColor"), white]);

Thanks again for your suggestion

Best Wishes

Keith

On 28/04/2022 16:04, Wolfgang Schuster wrote:
Keith McKay via ntg-context schrieb am 28.04.2022 um 12:05:

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="myColor1", r = uniformdeviate(1), g = uniformdeviate(1), b = uniformdeviate(1) ] ;


Remove the backslash in front of the definecolor command.

Wolfgang

--------------gDdolt8WPK6Gu6N01iCd8iTh-- --===============7534510876879992785== 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== --===============7534510876879992785==--