First, I’d like to remind everyone that if you want to share unmodified templates, you can. In this situation I assume you want to modify copied templates and use them as templates.
OK, for now here’s how you can copy and then modify a template:
// create the node template for the main Diagram
var diagramNodeTemplate =
$(go.Node, "Auto", nodeStyle(),
$(go.Shape, borderStyle()),
$(go.TextBlock, textStyle(true),
new go.Binding("text").makeTwoWay())
);
// copy the node template for the Palette
diagramNodeTemplate.data = {};
diagramNodeTemplate.data = null;
var paletteNodeTemplate = diagramNodeTemplate.copy();
// and modify the palette's node template
paletteNodeTemplate.elt(0).fill = "lightgreen";
paletteNodeTemplate.elt(1).font = "bold 12pt sans-serif";
Of course the details of the main diagram’s template(s) do not really matter. But remember that you cannot add, remove, or modify any Bindings once the template has been copied.
Perhaps in some future version we will have a Panel.copyTemplate() method or we can figure out a way for copy() to figure out if the intent is to copy a template or if the intent is to create an instance of the template.