diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index a225868..88f4249 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -11,7 +11,7 @@ import re from wireviz import wv_colors, __version__, APP_NAME, APP_URL from wireviz.DataClasses import Metadata, Options, Connector, Cable -from wireviz.wv_colors import get_color_hex +from wireviz.wv_colors import get_color_hex, translate_color from wireviz.wv_gv_html import nested_html_table, html_colorbar, html_image, \ html_caption, remove_links, html_line_breaks from wireviz.wv_bom import manufacturer_info_field, component_table_entry, \ @@ -121,7 +121,8 @@ class Harness: [html_line_breaks(connector.type), html_line_breaks(connector.subtype), f'{connector.pincount}-pin' if connector.show_pincount else None, - connector.color, html_colorbar(connector.color)], + translate_color(connector.color, self.options.color_mode) if connector.color else None, + html_colorbar(connector.color)], '' if connector.style != 'simple' else None, [html_image(connector.image)], [html_caption(connector.image)]] @@ -143,7 +144,7 @@ class Harness: pinhtml.append(f' {pinlabel}') if connector.pincolors: if pincolor in wv_colors._color_hex.keys(): - pinhtml.append(f' {pincolor}') + pinhtml.append(f' {translate_color(pincolor, self.options.color_mode)}') pinhtml.append( ' ') pinhtml.append( ' ') pinhtml.append(f' ') @@ -206,7 +207,8 @@ class Harness: f'{cable.gauge} {cable.gauge_unit}{awg_fmt}' if cable.gauge else None, '+ S' if cable.shield else None, f'{cable.length} {cable.length_unit}' if cable.length > 0 else None, - cable.color, html_colorbar(cable.color)], + translate_color(cable.color, self.options.color_mode) if cable.color else None, + html_colorbar(cable.color)], '', [html_image(cable.image)], [html_caption(cable.image)]] diff --git a/src/wireviz/wv_bom.py b/src/wireviz/wv_bom.py index 4cda483..286f30a 100644 --- a/src/wireviz/wv_bom.py +++ b/src/wireviz/wv_bom.py @@ -5,6 +5,7 @@ from typing import List, Union from collections import Counter from wireviz.DataClasses import Connector, Cable +from wireviz.wv_colors import translate_color from wireviz.wv_gv_html import html_line_breaks from wireviz.wv_helper import clean_whitespace @@ -46,7 +47,7 @@ def generate_bom(harness): + (f', {connector.type}' if connector.type else '') + (f', {connector.subtype}' if connector.subtype else '') + (f', {connector.pincount} pins' if connector.show_pincount else '') - + (f', {connector.color}' if connector.color else '')) + + (f', {translate_color(connector.color, harness.options.color_mode)}' if connector.color else '')) bom_entries.append({ 'item': description, 'qty': 1, 'unit': None, 'designators': connector.name if connector.show_name else None, 'manufacturer': connector.manufacturer, 'mpn': connector.mpn, 'pn': connector.pn @@ -76,7 +77,7 @@ def generate_bom(harness): description = ('Wire' + (f', {cable.type}' if cable.type else '') + (f', {cable.gauge} {cable.gauge_unit}' if cable.gauge else '') - + (f', {color}' if color else '')) + + (f', {translate_color(color, harness.options.color_mode)}' if color else '')) bom_entries.append({ 'item': description, 'qty': cable.length, 'unit': cable.length_unit, 'designators': cable.name if cable.show_name else None, 'manufacturer': index_if_list(cable.manufacturer, index),