I think I've figured something out but it would take a bit of an investment of time to set it up. It involves creating what's basically a lookup table for symbology.
Building the Table
Add a table to QGIS with no geometry, just an attribute table (for this example I will call it 'symbology_table').
Fields it will need (for example):
FieldName DataType Format Description
layer string exact match name of the layer used to look up symbology
stroke_col string 0,0,0,0 colour of stroke in RGBA format (r,b,g,alpha 0-255)
stroke_lw real 0.00 lineweight of the stroke
fill_col string 0,0,0,0 colour of fill in RGBA format (r,b,g,alpha 0-255)
Populate this with table with the names of the layers you want automatically styled and their corresponding style values. For example I want one layer called Study Area to have a red outline and a transparent red fill, and another layer called Site with a blue outline and fill I would add them to the table like this:
layer stroke_col stroke_lw fill_col
study area 255,0,0,255 0.5 255,0,0,100
site 0,0,255,255 0.5 0,0,255,100
Setting up the layers
Open the symbology of one of the layers and set the Fill color to this expression:
ATTRIBUTE(GET_FEATURE('symbology_table', 'layer', @layer_name), 'fill_col')
set the Stroke color to this:
ATTRIBUTE(GET_FEATURE('symbology_table', 'layer', @layer_name), 'stroke_col')
and the Stroke width to:
ATTRIBUTE(GET_FEATURE('symbology_table', 'layer', @layer_name), 'stroke_lw')
Now using the trusty Multi-layer style copying/pasting mentioned by @RafDouglas you can apply this styling to every single layer and as long as it has a value in the symbology_table it will take on it's own symbology.
- This won't update the symbols in the table of contents.
- You can add as many symbology fields as you want to the symbology_table, I just
used those generic ones as an example.
- This example was for setting the symbology of polygon layers, for point and line layers the theory is the same but it may need slight tweaking.