func (r *ColorGroup) Marshal3MF(x spec.Encoder, _ *xml.StartElement) error {
	xs := xml.StartElement{Name: xml.Name{Space: Namespace, Local: attrColorGroup}, Attr: []xml.Attr{
		{Name: xml.Name{Local: attrID}, Value: strconv.FormatUint(uint64(r.ID), 10)},
	}}
	x.EncodeToken(xs)
	x.SetAutoClose(true)
	x.SetSkipAttrEscape(true)
	start := xml.StartElement{Name: xml.Name{Space: Namespace, Local: attrColor}, Attr: []xml.Attr{
		{Name: xml.Name{Local: attrColor}},
	}}
	for _, c := range r.Colors {
		start.Attr[0].Value = spec.FormatRGBA(c)
		x.EncodeToken(start)
	}
	x.SetSkipAttrEscape(false)
	x.SetAutoClose(false)
	x.EncodeToken(xs.End())
	return nil
}
Marshal3MF encodes the resource.
package materials
import (
	"encoding/xml"
	"strconv"
	"strings"
	"github.com/hpinc/go3mf/spec"
)