It can be a lot of work to change the look of a map in QGIS: You have to change the colour and stroke width of numerous symbols — often consisting of several symbol layers — and the font of several label rules, and every step takes a lot of mouse clicks. Maybe you decide that all roads should be a little bit wider? The font size of labels a bit bigger? How about replacing a font that is used in many label rules with another one? Or turn a monochrome blue map into a pink one?
I wrote a python plugin in order to do all this quickly and consistently, with a few clicks. It allows to:
- adjust color of all symbols (including color ramps and any number of symbol layers) and labels using the HSV color model (rotate hue, change saturation and value)
- change line thickness (i.e. stroke width of all symbols / symbol borders)
- change font size of all labels
- replace a font family used in labels with another font family
- save / load the styles of all layers at once into/from a given folder
- … and all this either on all layers at once, only on the active layer or on selected or all visible layers.
The plugin is in the QGIS Plugins Repository and can be installed directly from QGIS (menu: Plugins > Manage and Install Plugins).
Alternatively, copy (or git clone) the folder with the source code into your QGIS plugin folder and enable the plugin in QGIS (menu: Plugins > Manage and Install Plugins).
Start the plugin from the Plugin menu or the plugin toolbar, a dockwidget opens on the right side of the main window. First, select the layers you want to work on. Possible choices:
- Active Layer
- Selected Layers
- Visible Layers
- All Layers
Adjusting colours works in the HSV colour model. That means you can rotate the hue of the HSV colours as you would rotate a colour wheel: set the degree of the rotation and hit “OK”. The colour grid above the slider works as a preview.
To adjust saturation and value (= brightness), click on the respective plus and minus buttons. Be careful: You can’t use the plus and minus button to undo the changes already made since the values of saturation and HSV value stay in the interval ranging from 0 to 255 and any colour arriving at these borders can’t be moved back consistently. It is good practice to save the layer styles before using these buttons!
Change the stroke width of lines and the borders of symbols of polygons and points by ± 5 % with clicks on the plus and minus buttons.
Note: Changing the colour of layers also changes the colour of labels (text, buffer and background).
Font Size: Use the plus / minus buttons to change the font size of labels by ± 5 %.
Replace Font: Choose the font family to be replaced and select a new font family.
Save and Load Styles
These buttons provide a quick way to save the styles of all (or all selected) layers. You only need to select a folder. The filename of the QML files corresponds to the layer name (with bad characters replaced by underscore). If there are several layers of the same name, you will get several files with an index value appended.
Should even work to save the styles of one project and load them in another one if the layer names match.