ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henri Menke <henrimenke@gmail.com>
To: ntg-context@ntg.nl
Subject: Re: Show the letters of the alphabet with a loop (Metapost)
Date: Sun, 3 Feb 2019 08:57:50 +1300	[thread overview]
Message-ID: <ca8893d6-0289-f38e-fc13-bc643ac853c0@gmail.com> (raw)
In-Reply-To: <CACyK-erxNFzf_u99uTr_f64hYUezSSko7=2U_3xmmkTSkAN9UA@mail.gmail.com>

On 2/2/19 11:49 PM, Fabrice Couvreur wrote:
> Hi Henri,
> Great ! I would also like these letters to be randomly colored.

You should play with randomseed, the starting color (here white) and the
randomization amplitude (1,1,1).  You mileage may vary.

\starttext

\startMPcode
  for i=0 upto 3 :
      for j=0 upto 3 :
          draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
      endfor ;
  endfor ;
  for i=0 upto 4 :
      for j=0 upto 4 :
          label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm))
              withcolor white randomized (1,1,1) ;
      endfor ;
  endfor ;
\stopMPcode

\stoptext

> Thank you.
> Fabrice
> 
> Le sam. 2 févr. 2019 à 11:16, Henri Menke <henrimenke@gmail.com> a écrit :
> 
>> On 2/2/19 10:47 PM, Fabrice Couvreur wrote:
>> > The idea is to display the first 25 letters of the alphabet. The code
>> below
>> > shows the letter a to show what I want to do.
>> > Thank you.
>> > Fabrice
>>
>> Use char and ASCII.
>>
>> \starttext
>>
>> \startMPcode
>>   for i=0 upto 3 :
>>       for j=0 upto 3 :
>>           draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>>       endfor ;
>>   endfor ;
>>   for i=0 upto 4 :
>>       for j=0 upto 4 :
>>           label.llft(char(i*5+j+ASCII "A"), (4*i*cm,4*j*cm)) ;
>>       endfor ;
>>   endfor ;
>> \stopMPcode
>>
>> \stoptext
>>
>> >
>> > \starttext
>> >
>> > \startMPcode
>> >   for i=0 upto 3 :
>> >       for j=0 upto 3 :
>> >           draw unitsquare scaled 4cm shifted (4*i*cm,4*j*cm) ;
>> >       endfor ;
>> >   endfor ;
>> >   for i=0 upto 4 :
>> >       for j=0 upto 4 :
>> >           label.llft("A", (4*i*cm,4*j*cm)) ;
>> >       endfor ;
>> >   endfor ;
>> > \stopMPcode
>> >
>> > \stoptext
>> >
>> >
>> >
>> ___________________________________________________________________________________
>> > 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
>> >
>> ___________________________________________________________________________________
>> >
>>
>>
>> ___________________________________________________________________________________
>> 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
>>
>> ___________________________________________________________________________________
>>
> 
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
> 

___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2019-02-02 19:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-02  9:47 Fabrice Couvreur
2019-02-02 10:16 ` Henri Menke
2019-02-02 10:49   ` Fabrice Couvreur
2019-02-02 19:57     ` Henri Menke [this message]
2019-02-03  9:12       ` Fabrice Couvreur
2019-02-03 11:50         ` Fabrice Couvreur
2019-02-03 20:19           ` Henri Menke
2019-02-03 20:26             ` Alan Braslau
2019-02-04  9:47               ` Fabrice Couvreur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca8893d6-0289-f38e-fc13-bc643ac853c0@gmail.com \
    --to=henrimenke@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).