[metapost] ANN: colordef package preview

Stephan Hennig mailing_list at arcor.de
Thu Feb 5 23:40:14 CET 2009


I have written a small package colordef, that makes the color names
defined by dvips, SVG and X11 available to MetaPost.  A preview can be
found at


Please test!  Comments are welcome!

I haven't named the package `color' intentionally, because I want to
leave that name open for a package, that provides some more operations
on colors, such as conversion between different color models or blending
colors similar to what the xcolor package provides.

Unfortunately, I have no idea how to implement an operator ! that works
like this:

  red!80  = .2[red, white]
  red!80!blue  = .2[red, blue]

The former case is simple, roughly

  primarydef col ! tint=
    min(1,max(0,tint/100))[white, col]

In the second case, however, there is the problem that from a MetaPost
point of view ! has two different meanings.

  primarydef colA ! tint ! colB=

doesn't seem to work.  Any ideas how to implement a color mixing
operator that works exactly like in xcolor?

Best regards,
Stephan Hennig

More information about the metapost mailing list