From 27028154f366b8be42e4a91e4c840e21457bf109 Mon Sep 17 00:00:00 2001 From: samwaseda Date: Thu, 19 Sep 2024 15:45:57 +0000 Subject: [PATCH 1/2] change color when failed --- pyiron_workflow/draw.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyiron_workflow/draw.py b/pyiron_workflow/draw.py index c3c3ba53..c9ebbff0 100644 --- a/pyiron_workflow/draw.py +++ b/pyiron_workflow/draw.py @@ -413,4 +413,7 @@ def graph(self) -> graphviz.graphs.Digraph: @property def color(self) -> str: + bright_red = "#FF0000" + if self.node.failed: + return bright_red return self.node.color From a07ef2841ea60b640cc1020ee2730a781b4ccc10 Mon Sep 17 00:00:00 2001 From: samwaseda Date: Fri, 20 Sep 2024 06:25:07 +0000 Subject: [PATCH 2/2] change only the border color --- pyiron_workflow/draw.py | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/pyiron_workflow/draw.py b/pyiron_workflow/draw.py index c9ebbff0..64500281 100644 --- a/pyiron_workflow/draw.py +++ b/pyiron_workflow/draw.py @@ -17,16 +17,29 @@ def directed_graph( - name, label, rankdir, color_start, color_end, gradient_angle, size=None + name, + label, + rankdir, + color_start, + color_end, + gradient_angle, + size=None, + style="filled", + fillcolor_start=None, + fillcolor_end=None, ): """A shortcut method for instantiating the type of graphviz graph we want""" + if fillcolor_start is None: + fillcolor_start = color_start + if fillcolor_end is None: + fillcolor_end = color_end digraph = graphviz.graphs.Digraph(name=name) digraph.attr( label=label, compound="true", rankdir=rankdir, - style="filled", - fillcolor=f"{color_start}:{color_end}", + style=style, + fillcolor=f"{fillcolor_start}:{fillcolor_end}", color=f"{color_start}:{color_end}", gradientangle=gradient_angle, fontname="helvetica", @@ -301,10 +314,13 @@ def __init__( self.name, self.label, rankdir=self.rankdir, - color_start=lighten_hex_color(self.color), - color_end=lighten_hex_color(self.color), + color_start=self.color, + color_end=self.color, gradient_angle="0", size=size, + style=self.style, + fillcolor_start=self.fillcolor, + fillcolor_end=self.fillcolor, ) self.inputs = Inputs(self) @@ -416,4 +432,13 @@ def color(self) -> str: bright_red = "#FF0000" if self.node.failed: return bright_red - return self.node.color + else: + return self.fillcolor + + @property + def fillcolor(self) -> str: + return lighten_hex_color(self.node.color) + + @property + def style(self) -> str: + return "filled, bold"