ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Metapost and TikZ color code equivalent
@ 2020-02-13 21:45 Fabrice Couvreur
  2020-02-14  1:49 ` Henri Menke
  2020-02-14 15:43 ` Fabrice L
  0 siblings, 2 replies; 8+ messages in thread
From: Fabrice Couvreur @ 2020-02-13 21:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,
How to have the color defined by {yellow!60!black} with Metapost ?
Thank you.
Fabrice

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

[-- Attachment #2: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Metapost and TikZ color code equivalent
  2020-02-13 21:45 Metapost and TikZ color code equivalent Fabrice Couvreur
@ 2020-02-14  1:49 ` Henri Menke
  2020-02-14 11:41   ` Fabrice Couvreur
  2020-02-14 15:43 ` Fabrice L
  1 sibling, 1 reply; 8+ messages in thread
From: Henri Menke @ 2020-02-14  1:49 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Metapost and TikZ color code equivalent
  2020-02-14  1:49 ` Henri Menke
@ 2020-02-14 11:41   ` Fabrice Couvreur
  0 siblings, 0 replies; 8+ messages in thread
From: Fabrice Couvreur @ 2020-02-14 11:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Metapost and TikZ color code equivalent
  2020-02-13 21:45 Metapost and TikZ color code equivalent Fabrice Couvreur
  2020-02-14  1:49 ` Henri Menke
@ 2020-02-14 15:43 ` Fabrice L
  2020-02-14 23:01   ` Fabrice Couvreur
  1 sibling, 1 reply; 8+ messages in thread
From: Fabrice L @ 2020-02-14 15:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,

> Le 13 févr. 2020 à 16:45, Fabrice Couvreur <fabrice1.couvreur@gmail.com> a écrit :

> How to have the color defined by {yellow!60!black} with Metapost ?

color MyColor ; MyColor := .6[yellow,black] ;

See metafun manual, section 1.13.

> Thank you.
> Fabrice

Fabrice (another one !).
> ___________________________________________________________________________________
> 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: 2284 bytes --]

[-- Attachment #2: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Metapost and TikZ color code equivalent
  2020-02-14 15:43 ` Fabrice L
@ 2020-02-14 23:01   ` Fabrice Couvreur
  2020-02-15 11:25     ` Fabrice Couvreur
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Couvreur @ 2020-02-14 23:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,
Hi,
I have corrected for the dimensions of the ellipse but I cannot achieve the
same effect for the red color.
Thank you.
Fabrice
\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.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
withcolor red;
    draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm);
    draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
         withshademethod "circular"
         withshadevector (0,1)
         withshadecolors (red,white)
  enddef;
  match((0,0));

\stopMPcode



Le ven. 14 févr. 2020 à 16:43, Fabrice L <fabrice.alpha@gmail.com> a écrit :

> Hi,
>
> Le 13 févr. 2020 à 16:45, Fabrice Couvreur <fabrice1.couvreur@gmail.com>
> a écrit :
>
>
> How to have the color defined by {yellow!60!black} with Metapost ?
>
>
> color MyColor ; MyColor := .6[yellow,black] ;
>
> See metafun manual, section 1.13.
>
> Thank you.
> Fabrice
>
>
> Fabrice (another one !).
>
>
> ___________________________________________________________________________________
> 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: 5024 bytes --]

[-- Attachment #2: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Metapost and TikZ color code equivalent
  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
  0 siblings, 2 replies; 8+ messages in thread
From: Fabrice Couvreur @ 2020-02-15 11:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi Henri,
Why does the blue path not rotate 90 with the draw command but rotate with
the fill command ?

\startMPcode

  def match (expr alpha, pos) =
    fill unitsquare xscaled 4cm  yscaled 0.2cm rotated alpha shifted pos
    withcolor yellow ;
    fill origin -- (4cm,0) -- (4.1cm,-0.05cm) --  (0.1cm,-0.05cm) --
    cycle rotated alpha withcolor(.6yellow + black);
    draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
    -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue;
     draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
    -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue;
    draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
    rotated alpha;
    draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
    rotated alpha
    withshademethod "circular 1"
    withshadevector (0,1)
    withshadecolors (red,white);
    enddef;
  match(0,(0,0));
  match(90,(4.2cm,0));
  match(90,(0,0));
  match(0,(0,4.2cm));

\stopMPcode


Le sam. 15 févr. 2020 à 00:01, Fabrice Couvreur <fabrice1.couvreur@gmail.com>
a écrit :

> Hi,
> Hi,
> I have corrected for the dimensions of the ellipse but I cannot achieve
> the same effect for the red color.
> Thank you.
> Fabrice
> \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.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
> withcolor red;
>     draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm);
>     draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
>          withshademethod "circular"
>          withshadevector (0,1)
>          withshadecolors (red,white)
>   enddef;
>   match((0,0));
>
> \stopMPcode
>
>
>
> Le ven. 14 févr. 2020 à 16:43, Fabrice L <fabrice.alpha@gmail.com> a
> écrit :
>
>> Hi,
>>
>> Le 13 févr. 2020 à 16:45, Fabrice Couvreur <fabrice1.couvreur@gmail.com>
>> a écrit :
>>
>>
>> How to have the color defined by {yellow!60!black} with Metapost ?
>>
>>
>> color MyColor ; MyColor := .6[yellow,black] ;
>>
>> See metafun manual, section 1.13.
>>
>> Thank you.
>> Fabrice
>>
>>
>> Fabrice (another one !).
>>
>>
>> ___________________________________________________________________________________
>> 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: 6897 bytes --]

[-- Attachment #2: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Metapost and TikZ color code equivalent
  2020-02-15 11:25     ` Fabrice Couvreur
@ 2020-02-15 12:25       ` Floris van Manen
  2020-02-15 20:48       ` Hans Hagen
  1 sibling, 0 replies; 8+ messages in thread
From: Floris van Manen @ 2020-02-15 12:25 UTC (permalink / raw)
  To: ntg-context

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]



On 15-02-2020 12:25, Fabrice Couvreur wrote:
> Hi Henri,
> Why does the blue path not rotate 90 with the draw command but rotate
> with the fill command?
> 

Why not draw the match as a picture first, then rotate and shift that
picture?
Also, if you use a local scale unit, it will be easier to stach the
matches together by merely applying a factor in match units.

.F

[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 2456 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Metapost and TikZ color code equivalent
  2020-02-15 11:25     ` Fabrice Couvreur
  2020-02-15 12:25       ` Floris van Manen
@ 2020-02-15 20:48       ` Hans Hagen
  1 sibling, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2020-02-15 20:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Fabrice Couvreur

On 2/15/2020 12:25 PM, Fabrice Couvreur wrote:
> Hi Henri,
> Why does the blue path not rotate 90 with the draw command but rotate 
> with the fill command?

compare

     draw  origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- 
(4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle  rotated alpha withcolor red;
     draw (origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- 
(4.1cm,-0.05cm) -- (0.1cm,-0.05cm) -- cycle) rotated alpha withcolor blue;



> \startMPcode
> 
>    def match (expr alpha, pos) =
>      fill unitsquare xscaled 4cm  yscaled 0.2cm rotated alpha shifted pos
>      withcolor yellow ;
>      fill origin -- (4cm,0) -- (4.1cm,-0.05cm) --  (0.1cm,-0.05cm) --
>      cycle rotated alpha withcolor(.6yellow + black);
>      draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
>      -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue;
>       draw origin -- (0,0.2cm) -- (4cm,0.2cm) -- (4cm,0) -- (4.1cm,-0.05cm)
>      -- (0.1cm,-0.05cm) -- cycle rotated alpha withcolor blue;
>      draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
>      rotated alpha;
>      draw fullcircle xscaled 0.50cm yscaled 0.44cm shifted (4.125cm,0.1cm)
>      rotated alpha
>      withshademethod "circular 1"
>      withshadevector (0,1)
>      withshadecolors (red,white);
>      enddef;
>    match(0,(0,0));
>    match(90,(4.2cm,0));
>    match(90,(0,0));
>    match(0,(0,4.2cm));
> 
> \stopMPcode-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-02-15 20:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 21:45 Metapost and TikZ color code equivalent Fabrice Couvreur
2020-02-14  1:49 ` Henri Menke
2020-02-14 11:41   ` Fabrice Couvreur
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

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).