How to bulk delete redundant layers that have the same layer-name?

It seems that some additional (redundant but not empty) Color layers appeared as I was working on a native-color font. This means that all my layers are native-color layers. Is there a way to remove all layers that are named ‘Color’? These appeared on their own, unfortunately I do not recall when this happened.

More detail:

  • I can select multiple layers and click the minus button, but I’d like to do a bulk action if possible as I have multiple masters and an already finished glyphset.
  • I can not see the extra ‘Color’ layers when selecting multiple glyphs, even when they have exactly the same layers and redundant layers
  • None of the redundant layers are empty and they do not contain the same outlines as their master
  • All redundant layers are named ‘Color’, and the rest (to keep) have been named after their Master

Here the 4 redundant ‘Color’ layers are visible:
Screenshot 2022-07-15 at 12.35.20
Screenshot 2022-07-15 at 12.35.25

When selecting both glyphs it is gone:
Screenshot 2022-07-15 at 12.35.33

Layers have outlines that do not match the master:

The following script deletes all non-master layers from the selected glyphs:

for selection in Font.selectedLayers:
	glyph = selection.parent
	for layer in list(glyph.layers):
		if not layer.isMasterLayer:

When multiple glyphs are selected, only the layers that they have in common are shown, which are the master layers.

1 Like

Thank you, this probably saved me a whole day :pray: