Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (22 sloc) 696 Bytes
Show a cube for each available color name
from vtkplotter import Plotter, Cube, Text
from vtkplotter.colors import colors, getColor
from operator import itemgetter
# sorting by hex color code:
sorted_colors = sorted(colors.items(), key=itemgetter(1))
# or by name:
# sorted_colors = sorted(colors.items(), key=itemgetter(0))
vp = Plotter(N=len(sorted_colors), axes=0, size="fullscreen", bg='w')
for i, sc in enumerate(sorted_colors):
cname = sc[0]
rgb = getColor(cname)
cb = Cube(c=rgb)
tname = Text(cname, pos=3), tname, at=i)
print("click on any cube and press i")
You can’t perform that action at this time.