I have a number of Kicad schematics and PCB layouts that I post on the web. For the PCB layouts I use Export->SVG in PcbNew. Since I switched from KiCad 5 to KiCad 7, these SVG images are generated with completely different colors than the colors in PcbNew.
How can I set the colors for a project to be identical in the SVG image and PcbNew.
So that the layouts in all projects have a consistent color scheme, I would like to adjust the colors of all layouts via script.
I don’t necessarily need a script, but information in which files the colors are set.
Try locating the .kicad_wks files that control colors for each editor (e.g., PcbNew). Open these files in a text editor and adjust color values to match your desired scheme.
(Remember to back up original files before modifying them)
For scripting, you might need to manually parse and update these files, as KiCad lacks a direct scripting API.
via Print I was able to create an image that corresponds to the one in pwbnew. To do this, the User color scheme must be selected in the Print dialog. Then print to a file, select path and file name. The generated image represents a whole A4 page with the small layout. Unfortunately, the SVG file is designed in such a way that I cannot determine the area with the layout, neither with inkscape nor with my own program. This is only possible manually.
For me it is easier to create a screenshot.
By the way, I have to notice that the colors created when exporting to SVG are not always the same, but more random.
I also can’t find a way to set the color scheme for export to SVG. I would like to be able to select a color scheme in the dialog like when printing. Or a working global configuration.
Yes I know that only user color schemes can be changed. I have tried it with my user scheme. The colors in the export to SVG matched a little better, but only almost. That was the reason I was talking about random colors.
Fact is, the colors in pcbnew and export to SVG are not consistent.
I have wasted a lot of time on this problem.
Kicad 6 generates SVG images that cannot be processed by standard tools
KiCad 7’s SVG images do not have this problem.
In both Kicad 6 aos and Kicad 7 the colors of pcbnew and Export SVG do not match.
I have over a hundred pcb-images published on my website. They are supposed to have a uniform appearance. For this reason I need a consistent representation. And of course I am not willing to manually create and edit all images from pcbnew to follow a color scheme from Kicad 7.
I guess I will go back to Kicad 5 and wait to see if this problem is solved.
I have decided to work with kicad 7. Much is better. I also find the new color scheme in pcbnew better, but continue to use the old because a change means a lot of work.
The export from pcbnew to a SVG file is not solved for me, but I make do with screenshots.
Since V4 I was doing SVG outputs by separately plotting layers to SVG and then combining them using inkscape. I remember then with V5 I have checked that I can get directly from KiCad (by modifying colors and than getting back to my working colors) what I want and I was happy until I had to get the same for the bottom side. Don’t remember what the problem was - probably the order of layer output.
So I decided to continue to use my method from V4.
Few days ago I have checked that now I am able to get directly from KiCad what I want. I change the color theme and then File-Plot to SVG but the key is what layer I specify as the output one and what as “Plot on All Layers”.
I want to have Courtyard picture on the gray copper as background. I have to specify the F.Cu in “Include Layers” and F.Courtyard and Edge.Cuts in “Plot on All Layers”.
If I specify F.Courtyard as my output with F.Cu as “Plot on All” then F.Cu hides F.Courtyard.
I think you’re wrong about F.Cu hiding F.Courtyard. When you plot an SVG, KiCad will only show the layers that are included in the “Include Layers” list. If you include F.Cu and F.Courtyard in the “Include Layers” list, then both layers will be visible in the SVG.
The “Plot on All Layers” option only affects the layers that are not included in the “Include Layers” list. So, if you set F.Cu as “Plot on All Layers”, then F.Cu will be visible even if it’s not included in the “Include Layers” list.
To test this, you can create a simple project with two layers: F.Cu and F.Courtyard. Set the color of F.Cu to gray and the color of F.Courtyard to red. Then, plot an SVG with F.Cu and F.Courtyard in the “Include Layers” list and additionally essay maybe help you. The result should be an SVG with a gray copper layer with a red courtyard on top.
It is not possible to create an SVG image of the layout in the PCB.
In the File->Export-SVG dialog, all ‘Copper layers’ and ‘Technical layers’ are activated, as well as ‘Board area only’. ‘Print one page per layer’ is disabled.
The result is an SVG similar to the one in pcpnew.
But all colors are different. Vias are not displayed.
If I activate ‘Print one page per layer’ I get 22 SVGs, but again the colors are not correct and vias are ignored.
What bothers me most is that the colors in pcbnew and SVG are not identical. This is under Preferences->PCB Editor->Colors with all settings ‘KiCad Classic’, ‘KiCad Default’, ‘User adapted’ the case.
I need an image that is largely the same as the one in pcbnew. Under KiCad 5.0 this was the case. I now use screenshot. This is more work, because after each change a new screenshot is necessary. Under 5.0 it was only a few clicks.
I just tried this and I get a SVG with the same colors as the board, with the only exception being that via holes are white in the SVG. Is this what you mean?
I use File-Plot and select Plot format: SVG or File-Fabrication Outputs-Gerbers that opens the same window as File-Plot.
But I don’t need the picture like at the screen during working.
I’m not sure what you can get that way - just try.