|
8 | 8 | from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, \ |
9 | 9 | nested_html_table, flatten2d, index_if_list, html_line_breaks, \ |
10 | 10 | graphviz_line_breaks, remove_line_breaks, open_file_read, open_file_write, \ |
11 | | - html_image, html_caption, manufacturer_info_field |
| 11 | + html_colorbar, html_image, html_caption, manufacturer_info_field |
12 | 12 | from collections import Counter |
13 | 13 | from typing import List |
14 | 14 | from pathlib import Path |
@@ -96,17 +96,13 @@ def create_graph(self) -> Graph: |
96 | 96 | [html_line_breaks(connector.type), |
97 | 97 | html_line_breaks(connector.subtype), |
98 | 98 | f'{connector.pincount}-pin' if connector.show_pincount else None, |
99 | | - connector.color, '<!-- colorbar -->' if connector.color else None], |
| 99 | + connector.color, html_colorbar(connector.color)], |
100 | 100 | '<!-- connector table -->' if connector.style != 'simple' else None, |
101 | 101 | [html_image(connector)], |
102 | 102 | [html_caption(connector)], |
103 | 103 | [html_line_breaks(connector.notes)]] |
104 | 104 | html.extend(nested_html_table(rows)) |
105 | 105 |
|
106 | | - if connector.color: # add color bar next to color info, if present |
107 | | - colorbar = f' bgcolor="{wv_colors.translate_color(connector.color, "HEX")}" width="4"></td>' # leave out '<td' from string to preserve any existing attributes of the <td> tag |
108 | | - html = [row.replace('><!-- colorbar --></td>', colorbar) for row in html] |
109 | | - |
110 | 106 | if connector.style != 'simple': |
111 | 107 | pinhtml = [] |
112 | 108 | pinhtml.append('<table border="0" cellspacing="0" cellpadding="3" cellborder="1">') |
@@ -173,17 +169,13 @@ def create_graph(self) -> Graph: |
173 | 169 | f'{cable.gauge} {cable.gauge_unit}{awg_fmt}' if cable.gauge else None, |
174 | 170 | '+ S' if cable.shield else None, |
175 | 171 | f'{cable.length} m' if cable.length > 0 else None, |
176 | | - cable.color, '<!-- colorbar -->' if cable.color else None], |
| 172 | + cable.color, html_colorbar(cable.color)], |
177 | 173 | '<!-- wire table -->', |
178 | 174 | [html_image(cable)], |
179 | 175 | [html_caption(cable)], |
180 | 176 | [html_line_breaks(cable.notes)]] |
181 | 177 | html.extend(nested_html_table(rows)) |
182 | 178 |
|
183 | | - if cable.color: # add color bar next to color info, if present |
184 | | - colorbar = f' bgcolor="{wv_colors.translate_color(cable.color, "HEX")}" width="4"></td>' # leave out '<td' from string to preserve any existing attributes of the <td> tag |
185 | | - html = [row.replace('><!-- colorbar --></td>', colorbar) for row in html] |
186 | | - |
187 | 179 | wirehtml = [] |
188 | 180 | wirehtml.append('<table border="0" cellspacing="0" cellborder="0">') # conductor table |
189 | 181 | wirehtml.append('<tr><td> </td></tr>') |
|
0 commit comments