Uniform colors in PcbNew

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.

I am very grateful for any hints.

This may help, change the colour, export, compare and adjust.

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.

Thanks,

in the board stackup section I can’t change the color of F.Cu and B.Cu for example.

I am working on Linux (Ubuntu).

I use empty.kicad_wks with
(page_layout
(setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)
(left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))
(line (name segm1:Line) (start 0 0) (end 0 0))
)

I tried with the Settings->PCB Editor->Colors and reset the colors to default values. The result had no effect.

Basically, the colors in the pcbNew are not so much the problem, but that other colors are displayed when exporting to SVG.

I have attached two images. The first one is a sceenshot from pcbnew. The second one is the SVG image.

It was created with

inkscape --export-dpi=1000 --export-area-drawing --export-background=black --export-filename= Exported.png Original.brd.svg

created.

How can I make the exported image use the same colors as pcbnew? Or how do I set the colors for pcbnew to look like the exported image.

I found out in the meantime that the color schemes are defined in ~/.config/kicad/7.0/.

When I have figured out what information is where and how it is related, I will be able to write a program that meets my requirements.

In PCBnew, you can output SVG in Two ways - the results have Different Colors. So, you decide which one to use…

Below shows the difference:

  • First Image, note the colors in the PCB
  • Second Image shows
    • BTM is SVG by: File>Export>SVG
    • TOP is SVG by: Plot>SVG

OOPS! I Mixed them up… now corrected

ADDED: A more Complete SVG by: Plot>SVG along with the settings. This is a good Color representation - similar to PCBnew with Silkscreen…

First Image:

Second Image:

Added Image…
Screen Shot 2023-08-13 at 11.08.52

Thanks BlackCoffe,

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.

Something you may have not realized, but Kicad color schemes are “read only”.
To change colors, give the “Theme” a new name.

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.

Hi,

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.

Cheers,
Miron

I think not. I have checked it before writing.

Do we speak about the same program :slight_smile:
I am speaking about KiCad 7.0.7 at Windows

No.
KiCad will not put them into one output file but generate separate file for each ot layers in “Include Layers” list.

F.Cu will be added to each of plots (separate files) from “Include Layers” list.

I see there nothing about KiCad SVG plot.

No! I will get 2 separate files.

I use KiCAD 7.07 on Linux.

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.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.