Creating materials for text/labels

I’m trying to extend the canvas text code example (https://playcanvas.com/project/362231/overview/tutorial-canvas-text) by creating and adding materials programmatically (https://playcanvas.com/editor/scene/527545).

So far, I’ve added the following to Text.prototype.initialize:
var material = new pc.PhongMaterial(); this.entity.model.meshInstances[0].material = material;
which seems to add a material, but the text isn’t visible.

What am I missing?

Also how can I change the colour of the new material?

TIA