with the environment of \startMPcode you can scale a color with a factor like 0.25red and 0.5blue But this not seem to work when you define a color yourself first definecolor [ name = "MyColor", r = .5, g = .25, b = .25 ] ; fill fullsquare xyscaled (40mm, 15mm) withcolor "MyColor" ; fill fullsquare xyscaled (40mm, 15mm) shifted (42mm, 0mm) withcolor 0.5"MyColor" ; What would be the correct way to scale self defined colors? .F
On 1/1/2025 10:02 PM, vm via ntg-context wrote:
with the environment of
\startMPcode you can scale a color with a factor like 0.25red and 0.5blue
But this not seem to work when you define a color yourself first
definecolor [ name = "MyColor", r = .5, g = .25, b = .25 ] ; fill fullsquare xyscaled (40mm, 15mm) withcolor "MyColor" ;
fill fullsquare xyscaled (40mm, 15mm) shifted (42mm, 0mm) withcolor 0.5"MyColor" ;
What would be the correct way to scale self defined colors?
define more colors anyway, you can try to comment line 1543 in mlib-pps.lmt and then, after making a new format file, see if \startMPpage definecolor [ name = "MyColor", r = .5, g = .25, b = .25 ] ; fill fullsquare xyscaled (40mm, 15mm) withcolor "MyColor" ; fill fullsquare xyscaled (40mm, 15mm) shifted (42mm, 0mm) withcolor .5 * namedcolor("MyColor") ; fill fullsquare xyscaled (40mm, 15mm) shifted (84mm, 0mm) withcolor .75 * namedcolor("MyColor") ; \stopMPpage works Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 01/01/2025 22:25, Hans Hagen wrote:
define more colors
anyway, you can try to comment line 1543 in mlib-pps.lmt and then, after making a new format file, see if
\startMPpage definecolor [ name = "MyColor", r = .5, g = .25, b = .25 ] ; fill fullsquare xyscaled (40mm, 15mm) withcolor "MyColor" ; fill fullsquare xyscaled (40mm, 15mm) shifted (42mm, 0mm) withcolor .5 * namedcolor("MyColor") ; fill fullsquare xyscaled (40mm, 15mm) shifted (84mm, 0mm) withcolor .75 * namedcolor("MyColor") ; \stopMPpage
works
thanks! I also came across the definition as described on page 32 of https://www.pragma-ade.nl/general/manuals/colors-mkiv.pdf \startMPcode color Salmon ; Salmon := ( 1.0, 0.568, 0.643 ) ; fill fullsquare xyscaled (40mm, 15mm) withcolor Salmon ; fill fullsquare xyscaled (40mm, 15mm) shifted (42mm,0) withcolor 0.5Salmon ; fill fullsquare xyscaled (40mm, 15mm) shifted (84mm,0) withcolor 1.5Salmon ; \stopMPcode works too
Hi,
It seems to work when defining a color as described in
https://wiki.contextgarden.net/Color_in_MetaPost , if that's an option:
________________________________________________
\startMPcode
color MyColor ;
MyColor = (.5, .25, .25) ;
fill fullsquare xyscaled (40mm, 15mm) withcolor MyColor ;
fill fullsquare xyscaled (40mm, 15mm) shifted (42mm, 0mm) withcolor
0.5MyColor ;
\stopMPcode
________________________________________________
Otherwise the solution proposed by Hans is probably better. (And may well
be better anyway!)
Cheers,
Florent
Le mer. 1 janv. 2025 à 21:05, vm via ntg-context
with the environment of
\startMPcode you can scale a color with a factor like 0.25red and 0.5blue
But this not seem to work when you define a color yourself first
definecolor [ name = "MyColor", r = .5, g = .25, b = .25 ] ; fill fullsquare xyscaled (40mm, 15mm) withcolor "MyColor" ;
fill fullsquare xyscaled (40mm, 15mm) shifted (42mm, 0mm) withcolor 0.5"MyColor" ;
What would be the correct way to scale self defined colors?
.F
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
participants (3)
-
Florent Michel
-
Hans Hagen
-
vm