Add custom colors and filles to tikzpy object (colors object)
Load main tikzpy class as follow and add colors to be used in 2D shapes and texts:
1import tikzpy
2
3### Load main object
4tikZ = tikzpy.pytikz()
5
6### Add point at x=0, y=0, z=0
7p0 = tikZ.pto.pto(0,0,0)
8
9### Add point at x=1, y=1, z=1
10p2 = tikZ.pto.pto(1,1,1)
11
12### Define custom color
13tikZ.col["custom_color_rgb"] = "150_50_5"
14tikZ.col["custom_color"] = "red!50"
15
16### Add a line for example
17l1 = self.tikZ.shp.line(p0, p1, color = "custom_color")
and start bulding your drawing. More examples on how to use the colors object can be found in colors examples as well as in the color property examples.
Colors functions. Class -> tikzpy.col
- class cls_colors._colors(parent)[source]
Colors object:
- Platform
Unix, Windows
- Synopsis
Allows to add colors in different formats, with or without tranparency. As well as modifiying the values.
- Variables
names – get list of unique ids of the colors containt in the colors object
num_colors – get number of unique ids of the colors containt in the colors object
Chracteristics of a colors (tikzpy.col) object
The object colors is workable as a python dictionary
A color can be set by his name, tikzpy.col[“navy”] = “blue”
A color can be get by his name, color_value = tikzpy.col[“navy”]