9 t
.define(r
"\renewcommand{\familydefault}{\ttdefault}")
11 # positioning is quite ugly ... but it works at the moment
18 # we could use (gray|rgb|cmyk).__dict__ to get the instances, but we
19 # would loose the ordering ... instead we just parse the file:
20 p
= re
.compile("(?P<id>(?P<model>[a-z]+)\\.(?P<name>[a-z]+)) += (?P=model)\\([0-9\\., ]+\\)\n", re
.IGNORECASE
)
21 lines
= imp
.find_module("color", pyx
.__path
__)[0].readlines()
22 for line
in lines
: # we yet don't use a file iterator
25 if lastmodel
and (m
.group("model") != lastmodel
):
27 myc
= pyx
.color
.__dict
__[m
.group("model")].__dict
__[m
.group("name")]
28 c
.stroke(path
.line(x
+ 0.1, y
+ 0.1, x
+ 0.4, y
+ 0.4), myc
)
29 c
.stroke(path
.line(x
+ 0.4, y
+ 0.1, x
+ 0.1, y
+ 0.4), myc
)
30 c
.fill(path
.rect(x
+ 0.5, y
, 1, 0.5), myc
)
31 c
.stroke(path
.line(x
+ 0.6, y
+ 0.1, x
+ 0.9, y
+ 0.4), color
.gray
.black
)
32 c
.stroke(path
.line(x
+ 0.9, y
+ 0.1, x
+ 0.6, y
+ 0.4), color
.gray
.black
)
33 c
.stroke(path
.line(x
+ 1.1, y
+ 0.1, x
+ 1.4, y
+ 0.4), color
.gray
.white
)
34 c
.stroke(path
.line(x
+ 1.4, y
+ 0.1, x
+ 1.1, y
+ 0.4), color
.gray
.white
)
35 t
.text(x
+ 1.7, y
+ 0.15, m
.group("id"), tex
.fontsize
.footnotesize
)
37 lastmodel
= m
.group("model")
43 c
.writetofile("colorname")