summaryrefslogtreecommitdiff
path: root/gerbonara/gerber/tests/image_support.py
diff options
context:
space:
mode:
Diffstat (limited to 'gerbonara/gerber/tests/image_support.py')
-rw-r--r--gerbonara/gerber/tests/image_support.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/gerbonara/gerber/tests/image_support.py b/gerbonara/gerber/tests/image_support.py
index 662dbed..c43f7b6 100644
--- a/gerbonara/gerber/tests/image_support.py
+++ b/gerbonara/gerber/tests/image_support.py
@@ -81,7 +81,9 @@ def gerbv_export(in_gbr, out_svg, export_format='svg', origin=(0, 0), size=(6, 6
else:
unit_spec = ''
- f.write(f'''(gerbv-file-version! "2.0A")(define-layer! 0 (cons 'filename "{in_gbr}"){unit_spec})''')
+ r, g, b = int(fg[1:3], 16), int(fg[3:5], 16), int(fg[5:], 16)
+ color = f"(cons 'color #({r*257} {g*257} {b*257}))"
+ f.write(f'''(gerbv-file-version! "2.0A")(define-layer! 0 (cons 'filename "{in_gbr}"){unit_spec}{color})''')
f.flush()
x, y = origin
@@ -89,7 +91,6 @@ def gerbv_export(in_gbr, out_svg, export_format='svg', origin=(0, 0), size=(6, 6
cmd = ['gerbv', '-x', export_format,
'--border=0',
f'--origin={x:.6f}x{y:.6f}', f'--window_inch={w:.6f}x{h:.6f}',
- f'--foreground={fg}',
f'--background={bg}',
'-o', str(out_svg), '-p', f.name]
subprocess.run(cmd, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)