ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Alan Braslau via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Alan Braslau <braslau.list@comcast.net>
Subject: Re: mp-geo Metapost package with ConTeXt
Date: Tue, 27 Jul 2021 08:29:08 +0200	[thread overview]
Message-ID: <a91a1c38-e67c-de05-f3c9-aadc5a463b1e@comcast.net> (raw)
In-Reply-To: <55DE2571-D12B-4C1E-B6CB-938B9A3177CF@comcast.net>

On 27/07/21 08:12, Gavin via ntg-context wrote:
> Hi All,
> 
> Getting Closer I asked:
> 
>>> 2) While I’m having good luck with paths, colors are causing trouble. In the data set the color information is in strings with French names of the color, like “rouge.” If I hand this string to MetaPost, MetaPost doesn’t expand it into a color. It does work if it is a native color, like “red,” but not if it is a defined color and not if the color is in a Lua variable. Any suggestions?
> 
> Aditya suggested:
> 
>> \definecolor[rouge][red] should work. A better option will be use color palettes.
> 
> This solves my problem of translating French colors into English, but not the problem of passing colors from Lua to MetaPost. If the string giving the color name is in a variable, it doesn’t go through. A path in a variable works.
> 
> I’ve reduced my MWE below – no French, no MPinclusions, no new colors. Both pie slices should be red, but one is black. Any ideas on getting the color “red” passed from Lua to MetaPost when mycolor=“red”?

I am not looking closely at the code, but in general we use

	fill fullcircle scaled 1cm withcolor red ;

and this takes Metapost's knowledge of red, the rgb triplet (1,0,0).
One can also use

	fill fullcircle scaled 1cm withcolor "red" ;

as a string (quotation) and this passes Context's definition of the color.

Alan



-- 
Alan
___________________________________________________________________________________
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:[~2021-07-27  6:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 14:43 Gavin
2021-07-15 15:48 ` Hans Hagen
2021-07-15 16:22   ` Aditya Mahajan
2021-07-15 17:58     ` Hans Hagen
2021-07-15 20:30       ` Bruce Horrocks
2021-07-16 19:55         ` Hans Hagen
2021-07-17  9:53           ` Bruce Horrocks
2021-07-17 10:20             ` Henning Hraban Ramm
2021-07-17 10:45               ` Hans Hagen
2021-07-17 11:05                 ` Henning Hraban Ramm
2021-10-22  9:31                 ` Henning Hraban Ramm via ntg-context
2021-10-22 13:35                   ` Hans Hagen via ntg-context
2021-10-22 14:16                   ` Henning Hraban Ramm via ntg-context
2021-10-22 14:27                     ` Hans Hagen via ntg-context
2021-07-17 10:53               ` Henning Hraban Ramm
2021-07-17 10:53               ` Hans Hagen
2021-07-17 12:42                 ` Arthur Rosendahl
2021-07-17 18:50                   ` Hans Hagen
2021-07-18 17:36                     ` Henning Hraban Ramm
2021-07-16 16:20       ` Gavin
     [not found]       ` <E1B2010C-A435-46AD-BD8E-F4D930827791@me.com>
2021-07-16 19:51         ` Hans Hagen
2021-07-16 20:08           ` Alan Braslau
2021-07-26 21:29             ` Gavin via ntg-context
2021-07-26 23:01               ` Aditya Mahajan via ntg-context
2021-07-27  6:12                 ` Gavin via ntg-context
2021-07-27  6:29                   ` Alan Braslau via ntg-context [this message]

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=a91a1c38-e67c-de05-f3c9-aadc5a463b1e@comcast.net \
    --to=ntg-context@ntg.nl \
    --cc=braslau.list@comcast.net \
    /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).