On 5-8-2011 9:07, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Hello,
I'd need to use the same color for text and drawing inside a MP code.
The typical situation looks the following way:
---- \definecolor[COL][.7red] \starttext \startMPcode label(btex \color[COL]{Some text} etex, (0, 0)); color col; col := .7red; draw unitsquare scaled .5cm withcolor col; \stopMPcode \stoptext ----
The problem is that the color must be defined twice - first as TeX's 'COL', later as MP's 'col'.
As far as I know, the 'COL' must be defined inside TeX code as colored text in MP is achieved *only* by calling TeX's "btex \a-color-family-command[a-color][some-text] etex".
So that's why I think the color must be defined in TeX.
But how to access the TeX's color in MP?
it's all in the metafun manual and also in example code ... withcolor \MPcolor{COL} ; ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------