1 import sys
; sys
.path
.insert(0, "../..")
7 # fallback implementation for Python 2.2 and below
9 return list(zip(list(range(len(list))), list))
14 # color conversion tests
19 color
.set(UCRc
=UCRc
, UCRm
=UCRm
, UCRy
=UCRy
, BG
=BG
)
21 def colrow(can
, pos
, acol
):
22 width
, height
= 1.0, 1.0
23 colors
= [acol
.grey(), acol
.rgb(), acol
.hsb(), acol
.cmyk()]
24 for i
, col
in enumerate(colors
):
25 can
.draw(path
.rect(pos
[0]+i
*width
, pos
[1], width
, height
), [deco
.filled([col
]), deco
.stroked()])
26 return pos
[0], pos
[1] - height
29 for col
in [color
.grey
.black
, color
.grey(0.25), color
.grey(0.5), color
.grey(0.75), color
.grey
.white
,
30 color
.rgb
.red
, color
.rgb
.green
, color
.rgb
.blue
, color
.rgb
.white
, color
.rgb
.black
,
31 color
.cmyk
.GreenYellow
, color
.cmyk
.Yellow
, color
.cmyk
.Goldenrod
, color
.cmyk
.Dandelion
, color
.cmyk
.Apricot
,
32 color
.cmyk
.Peach
, color
.cmyk
.Melon
, color
.cmyk
.YellowOrange
, color
.cmyk
.Orange
, color
.cmyk
.BurntOrange
,
33 color
.cmyk
.Bittersweet
, color
.cmyk
.RedOrange
, color
.cmyk
.Mahogany
, color
.cmyk
.Maroon
, color
.cmyk
.BrickRed
,
34 color
.cmyk
.Red
, color
.cmyk
.OrangeRed
, color
.cmyk
.RubineRed
, color
.cmyk
.WildStrawberry
, color
.cmyk
.Salmon
,
35 color
.cmyk
.CarnationPink
, color
.cmyk
.Magenta
, color
.cmyk
.VioletRed
, color
.cmyk
.Rhodamine
, color
.cmyk
.Mulberry
,
36 color
.cmyk
.RedViolet
, color
.cmyk
.Fuchsia
, color
.cmyk
.Lavender
, color
.cmyk
.Thistle
, color
.cmyk
.Orchid
,
37 color
.cmyk
.DarkOrchid
, color
.cmyk
.Purple
, color
.cmyk
.Plum
, color
.cmyk
.Violet
, color
.cmyk
.RoyalPurple
,
38 color
.cmyk
.BlueViolet
, color
.cmyk
.Periwinkle
, color
.cmyk
.CadetBlue
, color
.cmyk
.CornflowerBlue
,
39 color
.cmyk
.MidnightBlue
, color
.cmyk
.NavyBlue
, color
.cmyk
.RoyalBlue
, color
.cmyk
.Blue
, color
.cmyk
.Cerulean
,
40 color
.cmyk
.Cyan
, color
.cmyk
.ProcessBlue
, color
.cmyk
.SkyBlue
, color
.cmyk
.Turquoise
, color
.cmyk
.TealBlue
,
41 color
.cmyk
.Aquamarine
, color
.cmyk
.BlueGreen
, color
.cmyk
.Emerald
, color
.cmyk
.JungleGreen
, color
.cmyk
.SeaGreen
,
42 color
.cmyk
.Green
, color
.cmyk
.ForestGreen
, color
.cmyk
.PineGreen
, color
.cmyk
.LimeGreen
, color
.cmyk
.YellowGreen
,
43 color
.cmyk
.SpringGreen
, color
.cmyk
.OliveGreen
, color
.cmyk
.RawSienna
, color
.cmyk
.Sepia
, color
.cmyk
.Brown
, color
.cmyk
.Tan
,
44 color
.cmyk
.Gray
, color
.cmyk
.Black
, color
.cmyk
.White
, color
.cmyk
.white
, color
.cmyk
.black
]:
45 pos
= colrow(c
, pos
, col
)
48 c
.writeEPSfile("test_color", paperformat
=document
.paperformat
.A4
, fittosize
=1)
51 c
.fill(path
.rect(-1, -1, 2, 2), [color
.rgb
.red
])
52 c
.fill(path
.circle(0, 0, 1.2), [color
.transparency(0.5), color
.rgb
.green
])
53 c
.fill(path
.rect(-2, -0.5, 4, 1), [color
.transparency(0.9), color
.rgb
.blue
])
55 c
.writePDFfile("test_color", paperformat
=document
.paperformat
.A4
, fittosize
=1)