pcb-rnd knowledge pool


True layer colors

layer_color by Tibor 'Igor2' Palinkas on 2018-07-04

Tags: announcement, layer, color

node source



Abstract: Announcement and short intro of the new layer color system that allows setting layer color per board, per layer.


1. Old setup inherited from mainline

A central list of colors (from the config system in pcb-rnd). Whenever the code needed to draw a layer, it looked up its color in the config. If the layer was a copper layer, the color was picked from the array of layer colors, by layer ID, else it was one of the magic per-type layer colors (e.g. silk color). In mainline, this makes it almost impossible to change layer colors on a per board basis. In pcb-rnd, because of the more advanced conf system, it was possible to change layer colors on a per board basis, but it was not too easy, users had to remember numeric layer IDs, and there were some limitations (e.g. all silk layers had to have the same color).

2. New setup we have from now on

Each layer has its own layer color saved with the layer (starting from lihata board v5 that we are using since pcb-rnd 2.0.0). The config system holds only the "default layer colors" that are used initially if a new layer is created (or loaded from file without a color specified in the same file). In other words, once the layer color is set (or determined), it is ironed in the layer - as long as you are saving and loading the board using our native file format, the layer color is preserved. It is a layer property now, as much as the layer's name.

As a side effect this increases the flexibility of pcb-rnd: we have much less special cases and more control over layer colors. For example it is possible to create multiple silk layers with different color, or have a different mask layer color on top and bottom. Yet, if you don't care much about layer colors, the behavior is pretty much the same as before: unless you specify colors manually, colors are assigned from the default colors from the config. The only difference is that if you change the default colors in the config, it won't affect existing boards (at last those that are saved from now on).

Changing a layer color from the GUI: in the gtk hid, right click on the layer, edit properties, then edit row p/layer/color (value is in the usual #rrggbb format).

The user documentation got a new appendix with detailed description of how the new layer color system works.