Apply options.color_mode where showing color as text
This commit is contained in:
parent
2c12433d4b
commit
a4e301e227
@ -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)],
|
||||
'<!-- connector table -->' if connector.style != 'simple' else None,
|
||||
[html_image(connector.image)],
|
||||
[html_caption(connector.image)]]
|
||||
@ -143,7 +144,7 @@ class Harness:
|
||||
pinhtml.append(f' <td>{pinlabel}</td>')
|
||||
if connector.pincolors:
|
||||
if pincolor in wv_colors._color_hex.keys():
|
||||
pinhtml.append(f' <td sides="tbl">{pincolor}</td>')
|
||||
pinhtml.append(f' <td sides="tbl">{translate_color(pincolor, self.options.color_mode)}</td>')
|
||||
pinhtml.append( ' <td sides="tbr">')
|
||||
pinhtml.append( ' <table border="0" cellborder="1"><tr>')
|
||||
pinhtml.append(f' <td bgcolor="{wv_colors.translate_color(pincolor, "HEX")}" width="8" height="8" fixedsize="true"></td>')
|
||||
@ -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)],
|
||||
'<!-- wire table -->',
|
||||
[html_image(cable.image)],
|
||||
[html_caption(cable.image)]]
|
||||
|
||||
@ -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),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user