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