* [NTG-context] [ scaling colors ]
@ 2025-01-01 21:02 vm via ntg-context
2025-01-01 21:25 ` [NTG-context] " Hans Hagen
2025-01-01 21:29 ` Florent Michel
0 siblings, 2 replies; 4+ messages in thread
From: vm via ntg-context @ 2025-01-01 21:02 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: vm
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: [ scaling colors ]
2025-01-01 21:02 [NTG-context] [ scaling colors ] vm via ntg-context
@ 2025-01-01 21:25 ` Hans Hagen
2025-01-01 21:39 ` vm via ntg-context
2025-01-01 21:29 ` Florent Michel
1 sibling, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2025-01-01 21:25 UTC (permalink / raw)
To: ntg-context
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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: [ scaling colors ]
2025-01-01 21:02 [NTG-context] [ scaling colors ] vm via ntg-context
2025-01-01 21:25 ` [NTG-context] " Hans Hagen
@ 2025-01-01 21:29 ` Florent Michel
1 sibling, 0 replies; 4+ messages in thread
From: Florent Michel @ 2025-01-01 21:29 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1694 bytes --]
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 <ntg-context@ntg.nl> a
écrit :
> 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
>
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 2667 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
* [NTG-context] Re: [ scaling colors ]
2025-01-01 21:25 ` [NTG-context] " Hans Hagen
@ 2025-01-01 21:39 ` vm via ntg-context
0 siblings, 0 replies; 4+ messages in thread
From: vm via ntg-context @ 2025-01-01 21:39 UTC (permalink / raw)
To: ntg-context; +Cc: vm
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
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-01 21:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-01 21:02 [NTG-context] [ scaling colors ] vm via ntg-context
2025-01-01 21:25 ` [NTG-context] " Hans Hagen
2025-01-01 21:39 ` vm via ntg-context
2025-01-01 21:29 ` Florent Michel
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).