diff --git a/src/wireviz/DataClasses.py b/src/wireviz/DataClasses.py index 3996c08..6b3b1e3 100644 --- a/src/wireviz/DataClasses.py +++ b/src/wireviz/DataClasses.py @@ -88,6 +88,7 @@ class Cable: gauge_unit: Optional[str] = None show_equiv: bool = False length: float = 0 + color: Optional[str] = None wirecount: Optional[int] = None shield: bool = False notes: Optional[str] = None diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 7715cd6..c4c5869 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -163,11 +163,16 @@ class Harness: f'{len(cable.colors)}x' if cable.show_wirecount else None, f'{cable.gauge} {cable.gauge_unit}{awg_fmt}' if cable.gauge else None, '+ S' if cable.shield else None, - f'{cable.length} m' if cable.length > 0 else None], + f'{cable.length} m' if cable.length > 0 else None, + cable.color, '' if cable.color else None], '', [html_line_breaks(cable.notes)]] html = nested_html_table(rows) + if cable.color: # add color bar next to color info, if present + colorbar = f' bgcolor="{wv_colors.translate_color(cable.color, "HEX")}" width="4">' # leave out ' tag + html = html.replace('>', colorbar) + wirehtml = '' # conductor table wirehtml = f'{wirehtml}'