ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Fabrice Couvreur <fabrice1.couvreur@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Metapost and TikZ color code equivalent
Date: Fri, 14 Feb 2020 12:41:09 +0100	[thread overview]
Message-ID: <CACyK-eovrQ3oaROis0Dqpd=O0N--ySxBMvHGi33jfktpWpchyA@mail.gmail.com> (raw)
In-Reply-To: <ecdad1fa-cfc3-e18a-f216-e94a504cca34@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 3147 bytes --]

i Henri,
Thank you for your answer. The idea is to make the graph as an attachment. I
converted to Metapost but the road is still long!
The code is from percusse on StackExchange. As you can see, there is a
problem with the ellipse. How do I fix this ?
Thank you
Fabrice

\usemodule[tikz]
\starttext
\startMPcode
  def match (expr pos) =
    fill unitsquare xscaled 4cm  yscaled 0.2cm shifted pos withcolor yellow;
    fill origin -- (4cm,0) -- (4.1cm,-0.05cm) --  (0.1cm,-0.05cm) -- cycle
 withcolor(.6yellow + black);
    draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
-- (0.1cm,-0.05cm) -- cycle;
    fill fullcircle xscaled 0.25cm yscaled 0.22cm shifted (4.125cm,0.1cm)
withcolor red;
    draw fullcircle xscaled 0.25cm yscaled 0.22cm shifted (4.125cm,0.1cm)
         withshademethod "circular"
         withshadevector (0,1)
         withshadecolors (red,white)
  enddef;
  match((0,0));

\stopMPcode

\starttikzpicture
\define[2]\allumette{
    \fill [yellow] (#1,#2) rectangle (#1+4,#2+0.2);
    \fill [yellow!60!black] (#1,#2) -- ++(4,0)-- ++(0.1,-0.05) -- ++(-4,0)
-- ++(-0.1,0.05);
    \draw (#1,#2) -- ++(0,0.2) -- ++(4,0) -- ++(0,-0.2) -- ++(0.1,-0.05) --
++(-4,0) -- ++(-0.1,0.05);
    \shade[ball color=red] (#1+4,#2+0.1) ellipse (0.25cm and 0.22cm);
    \draw (#1+4,#2+0.1) ellipse (0.25cm and 0.22cm);
}
\allumette{0.1}{0.2}
\filldraw[orange,scale=0.5,shift={(8.2,1.2)}]  (0,0) .. controls
(-1.5,1.25) and (.5,2) .. (-.2,4) .. controls (1,2.5) and (1,.5) .. (0,0);
\stoptikzpicture
\stoptext

Le ven. 14 févr. 2020 à 02:49, Henri Menke <henrimenke@gmail.com> a écrit :

> On 2/14/20 10:45 AM, Fabrice Couvreur wrote:
> > Hi,
> > How to have the color defined by {yellow!60!black} with Metapost ?
>
> \usemodule[tikz]
> \starttext
> \startMPcode
> fill fullsquare scaled 1cm withcolor (.6yellow + black) ;
> \stopMPcode
>
> \starttikzpicture
> \fill[yellow!60!black] (0,0) rectangle (1,1);
> \stoptikzpicture
> \stoptext
>
>
> > Thank you.
> > Fabrice
> >
> >
> >
> ___________________________________________________________________________________
> > 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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 5264 bytes --]

[-- Attachment #2: allumettes.png --]
[-- Type: image/png, Size: 20401 bytes --]

[-- Attachment #3: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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:[~2020-02-14 11:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13 21:45 Fabrice Couvreur
2020-02-14  1:49 ` Henri Menke
2020-02-14 11:41   ` Fabrice Couvreur [this message]
2020-02-14 15:43 ` Fabrice L
2020-02-14 23:01   ` Fabrice Couvreur
2020-02-15 11:25     ` Fabrice Couvreur
2020-02-15 12:25       ` Floris van Manen
2020-02-15 20:48       ` Hans Hagen

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='CACyK-eovrQ3oaROis0Dqpd=O0N--ySxBMvHGi33jfktpWpchyA@mail.gmail.com' \
    --to=fabrice1.couvreur@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).