File: color.py

package info (click to toggle)
pyx3 0.16-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,880 kB
  • sloc: python: 22,065; ansic: 130; makefile: 93; sh: 8
file content (15 lines) | stat: -rw-r--r-- 439 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from pyx import *
unit.set(uscale=2, xscale=2)

col = color.cmyk.PineGreen

text.set(text.LatexEngine)
text.preamble(r"\usepackage{color}")
text.preamble(r"\definecolor{COL}{cmyk}{%g,%g,%g,%g}" % (col.c, col.m, col.y, col.k))

c = canvas.canvas()
c.text(0, 0, r"\textcolor{COL}{Text} and outline have the same color")
c.stroke(path.rect(-0.2, -0.2, 6.2, 0.6), [col])
c.writeEPSfile("color")
c.writePDFfile("color")
c.writeSVGfile("color")