mirror of https://github.com/mingrammer/diagrams
feat: add custom node class (#25)
* feat: add custom node class * docs: add example about custom node * docs: improve example about custom node usage * docs: fix variable namepull/31/head
parent
ae7b424aa0
commit
70addf3a64
@ -0,0 +1,20 @@
|
|||||||
|
"""
|
||||||
|
Custom provides the possibility of load an image to be presented as a node.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from diagrams import Node
|
||||||
|
|
||||||
|
|
||||||
|
class Custom(Node):
|
||||||
|
_provider = "custom"
|
||||||
|
_type = "custom"
|
||||||
|
_icon_dir = None
|
||||||
|
|
||||||
|
fontcolor = "#ffffff"
|
||||||
|
|
||||||
|
def _load_icon(self):
|
||||||
|
return self._icon
|
||||||
|
|
||||||
|
def __init__(self, label, icon_path):
|
||||||
|
self._icon = icon_path
|
||||||
|
super().__init__(label)
|
After Width: | Height: | Size: 77 KiB |
Loading…
Reference in new issue