What it does
Colours the layer name text shown in the Layers panel according to each layer's data source. Layer names, symbology, data sources and project structure are never changed. Categorised legend entries beneath a layer are left in the normal QGIS text colour — only the layer row itself is coloured.
What it colours
| Source | How it's matched |
|---|---|
| PostgreSQL layers | Your own rules (Configure dialog): database name or service= name, checked in order, first match wins. |
| GeoPackage layers | One fixed, editable colour. |
| Memory / temporary layers | One fixed, editable colour. |
| Everything else | Normal QGIS text colour (unchanged). |
No database or service names ship built in — add your own via Plugins → Colour Layer Panel Text by Source → Configure source colours…
The toggle button
A compact, icon-only, checkable button lives on the Layers panel's own toolbar only — it is not duplicated in the Plugins menu, which holds just the Configure entry. Its icon changes between a muted grey bar stack (off) and a coloured bar stack (on), so the state is visible without a text label. Tooltip: "Toggle layer-name colours by data source".
Setting up rules
- Open Plugins → Colour Layer Panel Text by Source → Configure source colours…
- Click Add rule to insert a row.
- The Value column is a dropdown, pre-filled with database/service names found in currently loaded PostgreSQL layers for the selected Match on type — pick one, or type your own if it isn't loaded.
- Pick a colour for the row, and repeat for further rules.
- Set GeoPackage and Memory/temporary colours in the row below the table, if wanted.
pg_service.conf entry
(service=...) instead of an explicit dbname=..., its name only
appears in the Value dropdown when Match on is set to "Service name" —
switch the row to that match type to find it.
Recovering from a broken plugin state
If QGIS's Layers panel becomes unusable after installing a plugin update:
- Close QGIS.
- Delete the plugin folder from
%APPDATA%\QGIS\QGIS4\profiles\default\python\plugins\colour_layer_panel_text_by_source. - Restart QGIS.
Compatibility & testing
QGIS 4.2 – 4.99 Python 3.12 Qt 6 / PyQt6. QGIS 3 is not supported.
Live-tested in QGIS 4.2.0 (Windows) against PostgreSQL layers spanning two
databases connected via authcfg. service= connections,
GeoPackage/memory colouring, group nodes, and other platforms/QGIS versions have not
yet been tested — please report issues at
the issue tracker
with the rule(s) you added and the layer's provider/URI (Properties → Source tab).
Author & licence
Ian Hay · github.com/ianhay/colour_layer_panel_text_by_source
Licensed under the GNU General Public License v3 or later (see LICENSE in the plugin's root folder).