File: colors.py

package info (click to toggle)
python-graphviz 0.20.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,188 kB
  • sloc: python: 4,098; makefile: 13
file content (20 lines) | stat: -rw-r--r-- 516 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3

"""https://graphviz.org/docs/attr-types/color"""

import graphviz

g = graphviz.Graph(filename='colors.gv')

red, green, blue = 64, 224, 208
assert f'#{red:x}{green:x}{blue:x}' == '#40e0d0'

g.node('RGB: #40e0d0', style='filled', fillcolor='#40e0d0')

g.node('RGBA: #ff000042', style='filled', fillcolor='#ff000042')

g.node('HSV: 0.051 0.718 0.627', style='filled', fillcolor='0.051 0.718 0.627')

g.node('name: deeppink', style='filled', fillcolor='deeppink')

g.view()