From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/114797 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Keith McKay via ntg-context Newsgroups: gmane.comp.tex.context Subject: Problem with a defined colour in MetaFun Date: Thu, 28 Apr 2022 11:05:18 +0100 Message-ID: <3fc7c602-d9de-6b68-e771-240eebee4cb8@gmail.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1554640776104301497==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18118"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Cc: Keith McKay To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Thu Apr 28 12:05:55 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 1nk123-0004TR-9v for gctc-ntg-context-518@m.gmane-mx.org; Thu, 28 Apr 2022 12:05:55 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 444302A382A; Thu, 28 Apr 2022 12:05:32 +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 nTJI1wf_ktyU; Thu, 28 Apr 2022 12:05:30 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4380B2A381F; Thu, 28 Apr 2022 12:05:30 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2BEB62A382A for ; Thu, 28 Apr 2022 12:05:28 +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 PgrwzMva-olk for ; Thu, 28 Apr 2022 12:05:27 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.221.52; helo=mail-wr1-f52.google.com; envelope-from=mckaymeister@gmail.com; receiver= Original-Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 3F1992A3817 for ; Thu, 28 Apr 2022 12:05:27 +0200 (CEST) Original-Received: by mail-wr1-f52.google.com with SMTP id s21so6025435wrb.8 for ; Thu, 28 Apr 2022 03:05:27 -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:from:subject:to :content-language; bh=NV7osn7pCqwl1piLJ8PpNYdyLFSfFRCF/vPdoFwPeyg=; b=SoIfw6+RQx27i4tv438Aby8Xe3tN7kWir8MPFLk42GG58m0RAKxvdHffMyl4f1q9HD 2BEHxGEWvVo2xWzhIoAAltyRevTPjm9Qw7VaIzwVDixuh4Jr+13j090XZjQbUpY+AxPx IMAsAVcyD7JJBXMiskN2fOW9BLdZHIHVkcG/81tRsnSjauIeIOlDLOvzmvhlD8ZQ0UYl xn1a5kKj/XJ2iZhRjWJk9H4H22T58GN/lTWsc31KEdZu8E+DxVC5DF4R73pyTynt0672 U8NkT2Y8PFiGI3qX5ScHoNMdF7Ke7Gm7Z9R7M7z0+aUvdZZBvCyPtis51xO7K90uEpJy Mx1g== 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:from :subject:to:content-language; bh=NV7osn7pCqwl1piLJ8PpNYdyLFSfFRCF/vPdoFwPeyg=; b=NTgukKpljgPuEleTRaRjldSPnpCYPs0mKjwyj0BAMi0h7ShZABwHpwU/RvVHThc+zv djh3jvd7seLp+lKczyVWnn8+75RyxkiBphpN1ahyXGXgqzg2wnlD0Qbf6lSXBO5Vin8z 8L81hRlrwW78Lx6RN0TJug+uY11Pzumm1HNJ0NnClJ7B/JR5DDOUP9Yv2mcT466dA+aA q4y3V7kUa2G39qFPLzxBJOy2zyddNYrdKHVhxb++MeHnIMWTwUqLgSWIB8JFeUX9yFXm 1EaoCfbFYOTSvIbJNOmt321sAH9cbJvh/5zLO/QvBFDOIXvZeP8j6/01Y3VDf+Vhh1m6 n7eg== X-Gm-Message-State: AOAM530Yl9acxVqJdb5cCHat2i6LV1mZQrGBNfN4CJmejkDWTE1VrXj8 GBf0jRgLasx1d+XEqPy0UFdcukCG7RE= X-Google-Smtp-Source: ABdhPJz8ApW0WzDkScV/DSY98+0Z07jx0P+bu4f8E7XN2heIsse43PR2qWjPGx4JYORqvVOXbYaVxA== X-Received: by 2002:a5d:6d81:0:b0:20a:88cf:c004 with SMTP id l1-20020a5d6d81000000b0020a88cfc004mr25715598wrs.41.1651140326542; Thu, 28 Apr 2022 03:05:26 -0700 (PDT) Original-Received: from ?IPV6:2a00:23c6:778a:3c01:f5c5:dd10:9bd6:5163? ([2a00:23c6:778a:3c01:f5c5:dd10:9bd6:5163]) by smtp.gmail.com with ESMTPSA id v188-20020a1cacc5000000b0038e9c60f0e7sm3688969wme.28.2022.04.28.03.05.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Apr 2022 03:05:26 -0700 (PDT) Content-Language: en-US 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:114797 Archived-At: This is a multi-part message in MIME format. --===============1554640776104301497== Content-Type: multipart/alternative; boundary="------------BBuFRe5LMxTN4PAga8XmIkyh" Content-Language: en-US This is a multi-part message in MIME format. --------------BBuFRe5LMxTN4PAga8XmIkyh Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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) ] ; fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor "myColor1"; for i =2 step 2 until 10: r := 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%%%%%%%%%%% I am running: system > system > ConTeXt ver: 2022.04.20 19:18 LMTX fmt: 2022.4.26 int: english/english system > system > 'cont-new.mkxl' loaded --------------BBuFRe5LMxTN4PAga8XmIkyh Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

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) ] ;

fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor "myColor1";

for i =2 step 2 until 10:

r := 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%%%%%%%%%%%

I am running:

system >

system > ConTeXt ver: 2022.04.20 19:18 LMTX fmt: 2022.4.26 int: english/english

system >

system > 'cont-new.mkxl' loaded

--------------BBuFRe5LMxTN4PAga8XmIkyh-- --===============1554640776104301497== 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== --===============1554640776104301497==--