<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Fabrice</p>
    <p>Thank you for your reply. It works the way I wanted. Wolfgang
      also replied and this has lead me to an alternative method. See my
      reply to him in this mailing list.<br>
    </p>
    <p>Best Wishes</p>
    <p>Keith<br>
    </p>
    <div class="moz-cite-prefix">On 28/04/2022 13:45, Fabrice L wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:30FAD77B-AB42-44C1-930F-9D2FE9D9D2CB@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Sorry, I was a little too enthusiastic, here here is the code :<br
        class="">
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">Le 28 avr. 2022 à 08:41, Fabrice L <<a
              href="mailto:fabrice.alpha@gmail.com"
              class="moz-txt-link-freetext" moz-do-not-send="true">fabrice.alpha@gmail.com</a>>
            a écrit :</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <meta charset="UTF-8" class="">
            <span style="caret-color: rgb(0, 0, 0); font-family:
              Helvetica; font-size: 12px; font-style: normal;
              font-variant-caps: normal; font-weight: 400;
              letter-spacing: normal; text-align: start; text-indent:
              0px; text-transform: none; white-space: normal;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              text-decoration: none; float: none; display: inline
              !important;" class="">Hi Keith,</span><br class=""
              style="caret-color: rgb(0, 0, 0); font-family: Helvetica;
              font-size: 12px; font-style: normal; font-variant-caps:
              normal; font-weight: 400; letter-spacing: normal;
              text-align: start; text-indent: 0px; text-transform: none;
              white-space: normal; word-spacing: 0px;
              -webkit-text-stroke-width: 0px; text-decoration: none;">
            <div style="caret-color: rgb(0, 0, 0); font-family:
              Helvetica; font-size: 12px; font-style: normal;
              font-variant-caps: normal; font-weight: 400;
              letter-spacing: normal; text-align: start; text-indent:
              0px; text-transform: none; white-space: normal;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              text-decoration: none;" class=""><br class="">
              <blockquote type="cite" class="">
                <div class="">Le 28 avr. 2022 à 06:05, Keith McKay via
                  ntg-context <<a href="mailto:ntg-context@ntg.nl"
                    class="moz-txt-link-freetext" moz-do-not-send="true">ntg-context@ntg.nl</a>>
                  a écrit :</div>
                <br class="Apple-interchange-newline">
                <div class="">
                  <p class="" style="white-space: pre-wrap;">Hi,</p>
                  <p class="" style="white-space: pre-wrap;">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.</p>
                  <p class="" style="white-space: pre-wrap;">Best Wishes</p>
                  <p class="" style="white-space: pre-wrap;">Keith McKay</p>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">%%%%%%%%%%%%%%%%%%%%MWE%%%%%%%%%%%%%</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">\setuppapersize[A4,portrait]</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">\usecolors[crayola]</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">\starttext</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">\dorecurse{10}{</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">\startMPpage</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">StartPage;</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">\definecolor[name="myColor1", r =  uniformdeviate(1), g = uniformdeviate(1), b = uniformdeviate(1) ] ;</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor  "myColor1";</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">for i =2 step 2 until 10:</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">r := i/10;</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) withcolor(r[\MPcolor{BurntSienna},white]);</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) withcolor(r[\MPcolor{myColor1}, white]);</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) withcolor(r[\MPcolor{"myColor1"}, white]);</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">%fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) withcolor(r[myColor1 ,  white]); This line causes an error.</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">endfor;</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">StopPage;</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">\stopMPpage</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">}</div>
                  <p class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">
</p>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">\stoptext</div>
                  <div class="" style="white-space: pre-wrap; margin: 0px; text-indent: 0px;">%%%%%%%%%%%%%%%%%%%%%%%%%%%end MWE%%%%%%%%%%%</div>
                  <div class="" style="white-space: pre-wrap;">
</div>
                </div>
              </blockquote>
              <div class=""><br class="">
              </div>
              Here is a solution, with works here, defining in another
              way the color «  myColor »:</div>
            <div style="caret-color: rgb(0, 0, 0); font-family:
              Helvetica; font-size: 12px; font-style: normal;
              font-variant-caps: normal; font-weight: 400;
              letter-spacing: normal; text-align: start; text-indent:
              0px; text-transform: none; white-space: normal;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              text-decoration: none;" class=""><br class="">
            </div>
            <div style="caret-color: rgb(0, 0, 0); font-family:
              Helvetica; font-size: 12px; font-style: normal;
              font-variant-caps: normal; font-weight: 400;
              letter-spacing: normal; text-align: start; text-indent:
              0px; text-transform: none; white-space: normal;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              text-decoration: none;" class="">
              <div class="">\setuppapersize[A4,portrait]</div>
              <div class="">\usecolors[crayola]</div>
              <div class="">\starttext</div>
              <div class="">\dorecurse{2}{</div>
              <div class="">\startMPpage</div>
              <div class="">StartPage;</div>
              <div class="">color myColor ;</div>
              <div class="">myColor :=
                (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));</div>
              <div class="">fill unitsquare xscaled PaperWidth yscaled
                PaperHeight withcolor myColor;</div>
              <div class="">for i =2 step 2 until 10:</div>
              <div class="">r := i/10;</div>
              <div class="">fill unitsquare xscaled 5cm yscaled .5cm
                shifted (1cm,i*cm)
                withcolor(r[\MPcolor{BurntSienna},white]);</div>
              <div class="">fill unitsquare xscaled 5cm yscaled .5cm
                shifted (7cm,i*cm) withcolor(r[\MPcolor{myColor1},
                white]);</div>
              <div class="">fill unitsquare xscaled 5cm yscaled .5cm
                shifted (13cm,i*cm) withcolor(r[\MPcolor{"myColor1"},
                white]);</div>
              <div class="">%fill unitsquare xscaled 5cm yscaled .5cm
                shifted (13cm,i*cm) withcolor(r[myColor1 ,  white]);
                This line causes an error.</div>
              <div class="">endfor;</div>
              <div class="">StopPage;</div>
              <div class="">\stopMPpage</div>
              <div class="">}</div>
              <div class=""><br class="">
              </div>
              <div class="">\stoptext</div>
            </div>
          </div>
        </blockquote>
        <div><br class="">
        </div>
        <div>I forgot to remove « myColor1 » from the others parts of
          the code. </div>
        <div>\setuppapersize[A4,portrait]</div>
        <div>\usecolors[crayola]</div>
        <div>\starttext</div>
        <div>\dorecurse{10}{</div>
        <div>\startMPpage</div>
        <div>StartPage;</div>
        <div>color myColor ;</div>
        <div>myColor :=
          (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));</div>
        <div>fill unitsquare xscaled PaperWidth yscaled PaperHeight
          withcolor myColor;</div>
        <div>for i =2 step 2 until 10:</div>
        <div>r := i/10;</div>
        <div>fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm)
          withcolor(r[\MPcolor{BurntSienna},white]);</div>
        <div>fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm)
          withcolor(r[myColor, white]);</div>
        <div>fill unitsquare xscaled 5cm yscaled .5cm shifted
          (13cm,i*cm) withcolor(r[myColor, white]);</div>
        <div>%fill unitsquare xscaled 5cm yscaled .5cm shifted
          (13cm,i*cm) withcolor(r[myColor1 ,  white]); This line causes
          an error.</div>
        <div>endfor;</div>
        <div>StopPage;</div>
        <div>\stopMPpage</div>
        <div>}</div>
        <div><br class="">
        </div>
        <div>\stoptext</div>
        <div><br class="">
        </div>
        <div><br class="">
        </div>
        <blockquote type="cite" class="">
          <div class="">
            <div style="caret-color: rgb(0, 0, 0); font-family:
              Helvetica; font-size: 12px; font-style: normal;
              font-variant-caps: normal; font-weight: 400;
              letter-spacing: normal; text-align: start; text-indent:
              0px; text-transform: none; white-space: normal;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              text-decoration: none;" class="">
              <div class=""><br class="">
              </div>
              <div class="">Fabrice.</div>
              <blockquote type="cite" class="">
                <div class="">
                  <div class="" style="white-space: pre-wrap;">
    
</div>
___________________________________________________________________________________<br
                    class="">
                  If your question is of interest to others as well,
                  please add an entry to the Wiki!<br class="">
                  <br class="">
                  maillist :<span class="Apple-converted-space"> </span><a
                    href="mailto:ntg-context@ntg.nl"
                    class="moz-txt-link-freetext" moz-do-not-send="true">ntg-context@ntg.nl</a><span
                    class="Apple-converted-space"> </span>/<span
                    class="Apple-converted-space"> </span><a
                    href="http://www.ntg.nl/mailman/listinfo/ntg-context"
                    class="moz-txt-link-freetext" moz-do-not-send="true">http://www.ntg.nl/mailman/listinfo/ntg-context</a><br
                    class="">
                  webpage  :<span class="Apple-converted-space"> </span><a
                    href="http://www.pragma-ade.nl/"
                    class="moz-txt-link-freetext" moz-do-not-send="true">http://www.pragma-ade.nl</a><span
                    class="Apple-converted-space"> </span>/<span
                    class="Apple-converted-space"> </span><a
                    href="http://context.aanhet.net/"
                    class="moz-txt-link-freetext" moz-do-not-send="true">http://context.aanhet.net</a><br
                    class="">
                  archive  :<span class="Apple-converted-space"> </span><a
href="https://bitbucket.org/phg/context-mirror/commits/"
                    class="moz-txt-link-freetext" moz-do-not-send="true">https://bitbucket.org/phg/context-mirror/commits/</a><br
                    class="">
                  wiki     :<span class="Apple-converted-space"> </span><a
                    href="http://contextgarden.net/"
                    class="moz-txt-link-freetext" moz-do-not-send="true">http://contextgarden.net</a><br
                    class="">
___________________________________________________________________________________</div>
              </blockquote>
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
    </blockquote>
  </body>
</html>